Add DebugFlags helper, improve format of HEADERS and SETTINGS frames

This commit is contained in:
Sean McArthur
2019-05-10 18:36:02 -07:00
parent dddef4ccbe
commit 44ff5e5c78
4 changed files with 108 additions and 29 deletions

View File

@@ -225,16 +225,9 @@ impl From<DataFlags> for u8 {
impl fmt::Debug for DataFlags {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let mut f = fmt.debug_struct("DataFlags");
if self.is_end_stream() {
f.field("end_stream", &true);
}
if self.is_padded() {
f.field("padded", &true);
}
f.finish()
util::debug_flags(fmt, self.0)
.flag_if(self.is_end_stream(), "END_STREAM")
.flag_if(self.is_padded(), "PADDED")
.finish()
}
}