pub struct TokenStream { /* private fields */ }Expand description
A cursor over a token stream for parsing.
Implementations§
Source§impl TokenStream
impl TokenStream
pub fn new(tokens: Vec<(Token, TokenSpan)>) -> Self
pub fn peek(&self) -> Option<&Token>
Sourcepub fn peek_span(&self) -> Option<TokenSpan>
pub fn peek_span(&self) -> Option<TokenSpan>
Span of the token currently at pos (the next call to peek/next would return it).
Sourcepub fn current_span(&self) -> Option<TokenSpan>
pub fn current_span(&self) -> Option<TokenSpan>
Span of the token most recently returned by next (i.e. at pos - 1).
pub fn next(&mut self) -> Option<&Token>
pub fn expect(&mut self, expected: &Token) -> Result<(), String>
pub fn at_end(&self) -> bool
pub fn position(&self) -> usize
Auto Trait Implementations§
impl Freeze for TokenStream
impl RefUnwindSafe for TokenStream
impl Send for TokenStream
impl Sync for TokenStream
impl Unpin for TokenStream
impl UnsafeUnpin for TokenStream
impl UnwindSafe for TokenStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more