diff options
-rw-r--r-- | buffered-reader/src/lib.rs | 17 | ||||
-rw-r--r-- | openpgp/src/parse.rs | 22 |
2 files changed, 17 insertions, 22 deletions
diff --git a/buffered-reader/src/lib.rs b/buffered-reader/src/lib.rs index 2b9a37b9..308187ea 100644 --- a/buffered-reader/src/lib.rs +++ b/buffered-reader/src/lib.rs @@ -816,6 +816,23 @@ pub trait BufferedReader<C> : io::Read + fmt::Debug + fmt::Display Ok(at_least_one_byte) } + /// Dump + /// A helpful debugging aid to pretty print a Buffered Reader stack. + fn dump(&self) where Self: std::marker::Sized { + let mut i = 1; + let mut reader: Option<&dyn BufferedReader<C>> = Some(self); + while let Some(r) = reader { + { + let cookie = r.cookie_ref(); + eprintln!(" {}. {}, {:?}", i, r, cookie); + } + reader = r.get_ref(); + i = i + 1; + } + } + + + /// Boxes the reader. fn as_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a> where Self: 'a + Sized diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index 17b3928c..f4a3a2ca 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -933,28 +933,6 @@ impl Cookie { reader = r.get_mut(); } } - - // A helpful debugging aid to pretty print a Buffered Reader - // stack. - #[allow(dead_code)] - fn dump(reader: &dyn BufferedReader<Cookie>) { - let mut i = 1; - let mut reader : Option<&dyn BufferedReader<Cookie>> = Some(reader); - while let Some(r) = reader { - { - let cookie = r.cookie_ref(); - - eprint!(" {}. {}, level: {:?}", - i, r, cookie.level); - if cookie.hashes_for != HashesFor::Nothing { - eprint!(", hashes for: {:?}", cookie.hashes_for); - } - eprint!("\n"); - } - reader = r.get_ref(); - i = i + 1; - } - } } // Pops readers from a buffered reader stack at the specified level. |