pub struct PrintingTokenSink<'a: 'b, 'b, S: TokenSink, W: Write> { /* private fields */ }Expand description
A token sink that prints a description of the tokens to a writer, and forwards them to another sink. For debugging.
Each token is output on one line. Start and end tokens adjust indentation.
§Example
Implementations§
Trait Implementations§
Source§impl<'a: 'b, 'b, S: TokenSink, W: Write> TokenSink for PrintingTokenSink<'a, 'b, S, W>
impl<'a: 'b, 'b, S: TokenSink, W: Write> TokenSink for PrintingTokenSink<'a, 'b, S, W>
type Error = PrintError<<S as TokenSink>::Error>
Source§fn yield_token(&mut self, token: Token<'_>) -> Result<bool, Self::Error>
fn yield_token(&mut self, token: Token<'_>) -> Result<bool, Self::Error>
Handles the next token from the stream. Returns true if the
sink requires more tokens.
Source§fn expect_tokens(&mut self) -> Option<TokenTypes>
fn expect_tokens(&mut self) -> Option<TokenTypes>
Returns the set of token types expected next. The
Self::yield_token function may accept or refuse any token;
this is an optional type negotation mechanism. E.g. if
String isn’t expected, but U32 is, then the source may
choose to do a conversion. In general, sources should not
expect sinks to do type conversions. Read more