Struct sqlite3_parser::lexer::Scanner
source · pub struct Scanner<S: Splitter> { /* private fields */ }
Expand description
Like a BufReader
but with a growable buffer.
Successive calls to the scan
method will step through the ‘tokens’
of a file, skipping the bytes between the tokens.
Scanning stops unrecoverably at EOF, the first I/O error, or a token too large to fit in the buffer. When a scan stops, the reader may have advanced arbitrarily far past the last token.
Implementations§
source§impl<S: Splitter> Scanner<S>
impl<S: Splitter> Scanner<S>
sourcepub fn scan<'input>(
&mut self,
input: &'input [u8],
) -> Result<(usize, Option<(&'input [u8], S::TokenType)>, usize), S::Error>
pub fn scan<'input>( &mut self, input: &'input [u8], ) -> Result<(usize, Option<(&'input [u8], S::TokenType)>, usize), S::Error>
Advance the Scanner to next token.
Return the token as a byte slice.
Return None
when the end of the input is reached.
Return any error that occurs while reading the input.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Scanner<S>where
S: Freeze,
impl<S> RefUnwindSafe for Scanner<S>where
S: RefUnwindSafe,
impl<S> Send for Scanner<S>where
S: Send,
impl<S> Sync for Scanner<S>where
S: Sync,
impl<S> Unpin for Scanner<S>where
S: Unpin,
impl<S> UnwindSafe for Scanner<S>where
S: UnwindSafe,
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