pub struct Lexer<'a> { /* private fields */ }Expand description
Streaming tokenizer over a byte slice. Holds a cursor into the
input; advance with Lexer::next_token.
Implementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
pub fn new(input: &'a [u8]) -> Self
Sourcepub fn seek(&mut self, pos: usize)
pub fn seek(&mut self, pos: usize)
Move the cursor to an absolute byte offset. Used by the object
parser when it needs to re-anchor (e.g. after consuming the
stream keyword + its EOL marker, the parser jumps the cursor
past the binary payload directly).
Sourcepub fn peek_byte(&self, offset: usize) -> Option<u8>
pub fn peek_byte(&self, offset: usize) -> Option<u8>
Peek at the byte at offset from the current position. Returns
None past EOF.
Sourcepub fn slice(&self, start: usize, end: usize) -> &'a [u8] ⓘ
pub fn slice(&self, start: usize, end: usize) -> &'a [u8] ⓘ
Borrow a slice of the input from start to end (clamped to
the input length). Used by the object parser for stream-body
extraction.
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