Reduce noise in Debug for Frame (#329)
This commit is contained in:
committed by
Carl Lerche
parent
4321caf6b3
commit
1a8015da4a
@@ -153,12 +153,16 @@ impl<T> From<Data<T>> for Frame<T> {
|
||||
|
||||
impl<T> fmt::Debug for Data<T> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("Data")
|
||||
.field("stream_id", &self.stream_id)
|
||||
.field("flags", &self.flags)
|
||||
.field("pad_len", &self.pad_len)
|
||||
// `data` purposefully excluded
|
||||
.finish()
|
||||
let mut f = fmt.debug_struct("Data");
|
||||
f.field("stream_id", &self.stream_id);
|
||||
if !self.flags.is_empty() {
|
||||
f.field("flags", &self.flags);
|
||||
}
|
||||
if let Some(ref pad_len) = self.pad_len {
|
||||
f.field("pad_len", pad_len);
|
||||
}
|
||||
// `data` bytes purposefully excluded
|
||||
f.finish()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +173,10 @@ impl DataFlags {
|
||||
DataFlags(bits & ALL)
|
||||
}
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
self.0 == 0
|
||||
}
|
||||
|
||||
fn is_end_stream(&self) -> bool {
|
||||
self.0 & END_STREAM == END_STREAM
|
||||
}
|
||||
|
||||
@@ -104,15 +104,15 @@ impl<T> fmt::Debug for Frame<T> {
|
||||
use self::Frame::*;
|
||||
|
||||
match *self {
|
||||
Data(ref frame) => write!(fmt, "Frame::Data({:?})", frame),
|
||||
Headers(ref frame) => write!(fmt, "Frame::Headers({:?})", frame),
|
||||
Priority(ref frame) => write!(fmt, "Frame::Priority({:?})", frame),
|
||||
PushPromise(ref frame) => write!(fmt, "Frame::PushPromise({:?})", frame),
|
||||
Settings(ref frame) => write!(fmt, "Frame::Settings({:?})", frame),
|
||||
Ping(ref frame) => write!(fmt, "Frame::Ping({:?})", frame),
|
||||
GoAway(ref frame) => write!(fmt, "Frame::GoAway({:?})", frame),
|
||||
WindowUpdate(ref frame) => write!(fmt, "Frame::WindowUpdate({:?})", frame),
|
||||
Reset(ref frame) => write!(fmt, "Frame::Reset({:?})", frame),
|
||||
Data(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
Headers(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
Priority(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
PushPromise(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
Settings(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
Ping(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
GoAway(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
WindowUpdate(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
Reset(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user