Skip to content

Commit 15c97fc

Browse files
committed
Make publicly exported types implement Debug trait
It seems to have become common practice for publicly exported types in a library to implement the Debug trait. Doing so potentially simplifies trouble shooting in client code directly but it also is a requirement in case said client code embeds such objects and wants the wrappers to implement this trait. For a deeper discussion of this topic please refer to rust-lang/rust#32054 To that end, this change adjust all publicly exported types to derive from Debug. It also adds a crate wide lint enforcing this constraint.
1 parent ba89e7e commit 15c97fc

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![deny(missing_debug_implementations)]
2+
13
extern crate byteorder;
24
extern crate num_traits;
35

@@ -13,4 +15,4 @@ pub mod proto;
1315
pub mod agent;
1416
pub mod error;
1517

16-
pub use self::agent::Agent;
18+
pub use self::agent::Agent;

src/proto/de.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use serde::de::{
88

99
use super::error::{ProtoError, ProtoResult};
1010

11+
#[derive(Debug)]
1112
pub struct Deserializer<R: io::Read> {
1213
reader: R,
1314
}
@@ -251,4 +252,4 @@ impl<'de, 'a, R: io::Read> VariantAccess<'de> for BinaryEnum<'a, R> {
251252
) -> ProtoResult<V::Value> {
252253
de::Deserializer::deserialize_map(self.de, visitor)
253254
}
254-
}
255+
}

src/proto/ser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use serde::ser::{self, Serialize};
33
use std::io;
44
use super::error::{ProtoError, ProtoResult};
55

6+
#[derive(Debug)]
67
pub struct Serializer<W: io::Write> {
78
// This string starts empty and JSON is appended as values are serialized.
89
writer: W

0 commit comments

Comments
 (0)