Struct castle_input_cursor::Cursor
source · [−]pub struct Cursor<R> { /* private fields */ }
Expand description
Cursor over the source code.
Implementations
sourceimpl<R> Cursor<R> where
R: Read,
impl<R> Cursor<R> where
R: Read,
sourcepub fn peek_n(&mut self, n: u8) -> Result<u32, Error>
pub fn peek_n(&mut self, n: u8) -> Result<u32, Error>
Peeks the next n bytes, the maximum number of peeked bytes is 4 (n <= 4).
sourcepub fn peek_char(&mut self) -> Result<Option<u32>, Error>
pub fn peek_char(&mut self) -> Result<Option<u32>, Error>
Peeks the next UTF-8 character in u32 code point.
sourcepub fn next_is(&mut self, byte: u8) -> Result<bool>
pub fn next_is(&mut self, byte: u8) -> Result<bool>
Compares the byte passed in to the next byte, if they match true is returned and the buffer is incremented
sourcepub fn next_is_char_pred<F>(&mut self, pred: &F) -> Result<bool> where
F: Fn(u32) -> bool,
pub fn next_is_char_pred<F>(&mut self, pred: &F) -> Result<bool> where
F: Fn(u32) -> bool,
Applies the predicate to the next UTF-8 character and returns the result. Returns false if there is no next character, otherwise returns the result from the predicate on the ascii char
The buffer is not incremented.
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for Cursor<R> where
R: RefUnwindSafe,
impl<R> Send for Cursor<R> where
R: Send,
impl<R> Sync for Cursor<R> where
R: Sync,
impl<R> Unpin for Cursor<R> where
R: Unpin,
impl<R> UnwindSafe for Cursor<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more