Skip to main content

TokenStream

Trait TokenStream 

Source
pub trait TokenStream {
    // Required methods
    fn advance(&mut self) -> bool;
    fn token(&self) -> &Token;
    fn token_mut(&mut self) -> &mut Token;

    // Provided methods
    fn next(&mut self) -> Option<&Token> { ... }
    fn process(&mut self, sink: &mut dyn FnMut(&Token)) { ... }
}
Expand description

Consumable token stream.

Required Methods§

Source

fn advance(&mut self) -> bool

Advance to the next token.

Source

fn token(&self) -> &Token

Access the current token.

Source

fn token_mut(&mut self) -> &mut Token

Mutate the current token.

Provided Methods§

Source

fn next(&mut self) -> Option<&Token>

Iterate to the next token and return it.

Source

fn process(&mut self, sink: &mut dyn FnMut(&Token))

Consume the remaining stream into the provided sink.

Trait Implementations§

Source§

impl<'a> TokenStream for Box<dyn TokenStream + 'a>

Source§

fn advance(&mut self) -> bool

Advance to the next token.
Source§

fn token(&self) -> &Token

Access the current token.
Source§

fn token_mut(&mut self) -> &mut Token

Mutate the current token.
Source§

fn next(&mut self) -> Option<&Token>

Iterate to the next token and return it.
Source§

fn process(&mut self, sink: &mut dyn FnMut(&Token))

Consume the remaining stream into the provided sink.

Implementations on Foreign Types§

Source§

impl<'a> TokenStream for Box<dyn TokenStream + 'a>

Source§

fn advance(&mut self) -> bool

Source§

fn token(&self) -> &Token

Source§

fn token_mut(&mut self) -> &mut Token

Implementors§