pub struct Lexer<'a> { /* private fields */ }Expand description
The scanner. It holds the source and a cursor and nothing else.
Implementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
Sourcepub fn new(source: &'a [u8]) -> Lexer<'a>
pub fn new(source: &'a [u8]) -> Lexer<'a>
Returns a lexer positioned at the start of the source.
Sourcepub fn at(source: &'a [u8], offset: usize) -> Lexer<'a>
pub fn at(source: &'a [u8], offset: usize) -> Lexer<'a>
Returns a lexer positioned at a byte offset in the source.
Sourcepub fn next_token(&mut self) -> Result<Token, LexError>
pub fn next_token(&mut self) -> Result<Token, LexError>
Scans and returns the next token, skipping trivia first.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnsafeUnpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'a>
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