Support Debug and Display for ParseBuffer
diff --git a/src/parse.rs b/src/parse.rs
index 8ca7d2e..2b816d9 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -197,7 +197,7 @@
//! *This module is available if Syn is built with the `"parsing"` feature.*
use std::cell::Cell;
-use std::fmt::Display;
+use std::fmt::{self, Debug, Display};
use std::marker::PhantomData;
use std::mem;
use std::ops::Deref;
@@ -268,6 +268,18 @@
}
}
+impl<'a> Display for ParseBuffer<'a> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ Display::fmt(&self.cursor().token_stream(), f)
+ }
+}
+
+impl<'a> Debug for ParseBuffer<'a> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ Debug::fmt(&self.cursor().token_stream(), f)
+ }
+}
+
/// Cursor state associated with speculative parsing.
///
/// This type is the input of the closure provided to [`ParseStream::step`].