pub struct Reader<T, const BUFFER_SIZE: usize = BYTE_BUFFER_SIZE> { /* private fields */ }Expand description
A generic UTF-8 character reader for lexers.
The generic parameter BUFFER_SIZE specifies the size of the internal
buffer of Reader.
Reader always tries to read UTF-8 characters from the stream.
If there are no valid UTF-8 characters, Reader will return a
fatal error (Error::Fatal).
Implementations§
Source§impl<T> Reader<T>
impl<T> Reader<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Converts the reader into its inner reader.
Trait Implementations§
Source§impl<T> InputStream for Reader<T>where
T: Read,
impl<T> InputStream for Reader<T>where
T: Read,
Source§fn next_char_loc(&mut self) -> Result<(Option<char>, Location)>
fn next_char_loc(&mut self) -> Result<(Option<char>, Location)>
Reads the next character from the input stream. Read more
Source§fn unread(&mut self, last: (Option<char>, Location))
fn unread(&mut self, last: (Option<char>, Location))
Unreads the given character and the last location
and put it back to the input stream.
Source§fn set_line_col(&mut self, line: u32, col: u32)
fn set_line_col(&mut self, line: u32, col: u32)
Sets the line and column of the current span. Read more
Source§fn peek(&mut self) -> Result<Option<char>>
fn peek(&mut self) -> Result<Option<char>>
Peeks the next character from the input stream. Read more
Source§fn peek_with_span(&mut self) -> Result<(Option<char>, Span)>
fn peek_with_span(&mut self) -> Result<(Option<char>, Span)>
Peeks the next character from the input stream.
Returns the peeked character and its span. Read more
Source§fn next_char(&mut self) -> Result<Option<Self::CharType>>
fn next_char(&mut self) -> Result<Option<Self::CharType>>
Reads the next character from the input stream. Read more
Source§fn next_char_span(&mut self) -> Result<(Option<Self::CharType>, Span)>
fn next_char_span(&mut self) -> Result<(Option<Self::CharType>, Span)>
Reads the next character from the input stream. Read more
Source§fn next_span(&mut self) -> Result<&Span>
fn next_span(&mut self) -> Result<&Span>
Reads the next character from the input stream. Read more
Source§fn skip_until<F>(&mut self, f: F) -> Result<()>
fn skip_until<F>(&mut self, f: F) -> Result<()>
Skips characters until a character specified by the predicate is encountered.
Auto Trait Implementations§
impl<T, const BUFFER_SIZE: usize> Freeze for Reader<T, BUFFER_SIZE>where
T: Freeze,
impl<T, const BUFFER_SIZE: usize> RefUnwindSafe for Reader<T, BUFFER_SIZE>where
T: RefUnwindSafe,
impl<T, const BUFFER_SIZE: usize> Send for Reader<T, BUFFER_SIZE>where
T: Send,
impl<T, const BUFFER_SIZE: usize> Sync for Reader<T, BUFFER_SIZE>where
T: Sync,
impl<T, const BUFFER_SIZE: usize> Unpin for Reader<T, BUFFER_SIZE>where
T: Unpin,
impl<T, const BUFFER_SIZE: usize> UnwindSafe for Reader<T, BUFFER_SIZE>where
T: 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