Skip to content

Commit

Permalink
feat(debug): add Debug impls for StatusClass, Server, and Listening
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Apr 16, 2015
1 parent 9a8ea4a commit 0fb92ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ pub enum RedirectPolicy {
// This is a hack because of upstream typesystem issues.
impl Clone for RedirectPolicy {
fn clone(&self) -> RedirectPolicy {
*self
*self
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! HTTP Server
use std::fmt;
use std::io::{ErrorKind, BufWriter, Write};
use std::marker::PhantomData;
use std::net::{SocketAddr, ToSocketAddrs};
Expand Down Expand Up @@ -34,6 +35,7 @@ mod listener;
///
/// Once listening, it will create a `Request`/`Response` pair for each
/// incoming connection, and hand them to the provided handler.
#[derive(Debug)]
pub struct Server<'a, H: Handler, L = HttpListener> {
handler: H,
ssl: Option<(&'a Path, &'a Path)>,
Expand Down Expand Up @@ -187,6 +189,12 @@ pub struct Listening {
pub socket: SocketAddr,
}

impl fmt::Debug for Listening {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Listening {{ socket: {:?} }}", self.socket)
}
}

impl Drop for Listening {
fn drop(&mut self) {
let _ = self._guard.take().map(|g| g.join());
Expand Down
2 changes: 1 addition & 1 deletion src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ impl Ord for StatusCode {
///
/// This can be used in cases where a status code’s meaning is unknown, also,
/// to get the appropriate *category* of status.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
pub enum StatusClass {
/// 1xx (Informational): The request was received, continuing process
Informational,
Expand Down

0 comments on commit 0fb92ee

Please sign in to comment.