Skip to content

Commit b8f3872

Browse files
author
Jonathan Woollett-Light
committed
fix: missing_debug_implementations
Public types should have `std::fmt::Debug` implementations. Signed-off-by: Jonathan Woollett-Light <[email protected]>
1 parent 0d0fdcd commit b8f3872

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/connection.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const BUFFER_SIZE: usize = 1024;
1919
const SCM_MAX_FD: usize = 253;
2020

2121
/// Describes the state machine of an HTTP connection.
22+
#[derive(Debug)]
2223
enum ConnectionState {
2324
WaitingForRequestLine,
2425
WaitingForHeaders,
@@ -27,6 +28,7 @@ enum ConnectionState {
2728
}
2829

2930
/// A wrapper over a HTTP Connection.
31+
#[derive(Debug)]
3032
pub struct HttpConnection<T> {
3133
/// A partial request that is still being received.
3234
pending_request: Option<Request>,

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
#![deny(missing_docs)]
3+
#![deny(missing_docs, missing_debug_implementations)]
44
//! Minimal implementation of the [HTTP/1.0](https://tools.ietf.org/html/rfc1945)
55
//! and [HTTP/1.1](https://www.ietf.org/rfc/rfc2616.txt) protocols.
66
//!

src/router.rs

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// SPDX-License-Identifier: Apache-2.0
55

66
use std::collections::hash_map::{Entry, HashMap};
7+
use std::fmt;
78

89
use crate::{MediaType, Method, Request, Response, StatusCode, Version};
910

@@ -24,6 +25,17 @@ pub struct HttpRoutes<T> {
2425
routes: HashMap<String, Box<dyn EndpointHandler<T> + Sync + Send>>,
2526
}
2627

28+
impl<T> fmt::Debug for HttpRoutes<T> {
29+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30+
f.debug_struct("HttpRoutes")
31+
.field("server_id", &self.server_id)
32+
.field("prefix", &self.prefix)
33+
.field("media_type", &self.media_type)
34+
.field("routes", &"{ .. }")
35+
.finish()
36+
}
37+
}
38+
2739
impl<T: Send> HttpRoutes<T> {
2840
/// Create a http request router.
2941
pub fn new(server_id: String, prefix: String) -> Self {

src/server.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl ServerRequest {
5959
}
6060

6161
/// Wrapper over `Response` which adds an identification token.
62+
#[derive(Debug)]
6263
pub struct ServerResponse {
6364
/// Inner response.
6465
response: Response,
@@ -74,7 +75,7 @@ impl ServerResponse {
7475

7576
/// Describes the state of the connection as far as data exchange
7677
/// on the stream is concerned.
77-
#[derive(PartialOrd, PartialEq)]
78+
#[derive(Debug, PartialOrd, PartialEq)]
7879
enum ClientConnectionState {
7980
AwaitingIncoming,
8081
AwaitingOutgoing,
@@ -83,6 +84,7 @@ enum ClientConnectionState {
8384

8485
/// Wrapper over `HttpConnection` which keeps track of yielded
8586
/// requests and absorbed responses.
87+
#[derive(Debug)]
8688
struct ClientConnection<T> {
8789
/// The `HttpConnection` object which handles data exchange.
8890
connection: HttpConnection<T>,
@@ -249,6 +251,7 @@ impl<T: Read + Write + ScmSocket> ClientConnection<T> {
249251
/// break;
250252
/// }
251253
/// ```
254+
#[derive(Debug)]
252255
pub struct HttpServer {
253256
/// Socket on which we listen for new connections.
254257
socket: UnixListener,

0 commit comments

Comments
 (0)