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> {
|
impl<T> fmt::Debug for Data<T> {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||||
fmt.debug_struct("Data")
|
let mut f = fmt.debug_struct("Data");
|
||||||
.field("stream_id", &self.stream_id)
|
f.field("stream_id", &self.stream_id);
|
||||||
.field("flags", &self.flags)
|
if !self.flags.is_empty() {
|
||||||
.field("pad_len", &self.pad_len)
|
f.field("flags", &self.flags);
|
||||||
// `data` purposefully excluded
|
}
|
||||||
.finish()
|
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)
|
DataFlags(bits & ALL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_empty(&self) -> bool {
|
||||||
|
self.0 == 0
|
||||||
|
}
|
||||||
|
|
||||||
fn is_end_stream(&self) -> bool {
|
fn is_end_stream(&self) -> bool {
|
||||||
self.0 & END_STREAM == END_STREAM
|
self.0 & END_STREAM == END_STREAM
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,15 +104,15 @@ impl<T> fmt::Debug for Frame<T> {
|
|||||||
use self::Frame::*;
|
use self::Frame::*;
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
Data(ref frame) => write!(fmt, "Frame::Data({:?})", frame),
|
Data(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
Headers(ref frame) => write!(fmt, "Frame::Headers({:?})", frame),
|
Headers(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
Priority(ref frame) => write!(fmt, "Frame::Priority({:?})", frame),
|
Priority(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
PushPromise(ref frame) => write!(fmt, "Frame::PushPromise({:?})", frame),
|
PushPromise(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
Settings(ref frame) => write!(fmt, "Frame::Settings({:?})", frame),
|
Settings(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
Ping(ref frame) => write!(fmt, "Frame::Ping({:?})", frame),
|
Ping(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
GoAway(ref frame) => write!(fmt, "Frame::GoAway({:?})", frame),
|
GoAway(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
WindowUpdate(ref frame) => write!(fmt, "Frame::WindowUpdate({:?})", frame),
|
WindowUpdate(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
Reset(ref frame) => write!(fmt, "Frame::Reset({:?})", frame),
|
Reset(ref frame) => fmt::Debug::fmt(frame, fmt),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user