feat(debug): add Debug impls for StatusClass, Server, and Listening

This commit is contained in:
Sean McArthur
2015-04-16 10:04:51 -07:00
parent 9a8ea4a267
commit 0fb92ee735
3 changed files with 10 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
//! HTTP Server
use std::fmt;
use std::io::{ErrorKind, BufWriter, Write};
use std::marker::PhantomData;
use std::net::{SocketAddr, ToSocketAddrs};
@@ -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)>,
@@ -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());