Skip to content

Commit 0fb92ee

Browse files
committed
feat(debug): add Debug impls for StatusClass, Server, and Listening
1 parent 9a8ea4a commit 0fb92ee

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ pub enum RedirectPolicy {
349349
// This is a hack because of upstream typesystem issues.
350350
impl Clone for RedirectPolicy {
351351
fn clone(&self) -> RedirectPolicy {
352-
*self
352+
*self
353353
}
354354
}
355355

src/server/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! HTTP Server
2+
use std::fmt;
23
use std::io::{ErrorKind, BufWriter, Write};
34
use std::marker::PhantomData;
45
use std::net::{SocketAddr, ToSocketAddrs};
@@ -34,6 +35,7 @@ mod listener;
3435
///
3536
/// Once listening, it will create a `Request`/`Response` pair for each
3637
/// incoming connection, and hand them to the provided handler.
38+
#[derive(Debug)]
3739
pub struct Server<'a, H: Handler, L = HttpListener> {
3840
handler: H,
3941
ssl: Option<(&'a Path, &'a Path)>,
@@ -187,6 +189,12 @@ pub struct Listening {
187189
pub socket: SocketAddr,
188190
}
189191

192+
impl fmt::Debug for Listening {
193+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
194+
write!(f, "Listening {{ socket: {:?} }}", self.socket)
195+
}
196+
}
197+
190198
impl Drop for Listening {
191199
fn drop(&mut self) {
192200
let _ = self._guard.take().map(|g| g.join());

src/status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl Ord for StatusCode {
558558
///
559559
/// This can be used in cases where a status code’s meaning is unknown, also,
560560
/// to get the appropriate *category* of status.
561-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
561+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
562562
pub enum StatusClass {
563563
/// 1xx (Informational): The request was received, continuing process
564564
Informational,

0 commit comments

Comments
 (0)