pub struct TokenCursor {
pub tokens: Vec<Token>,
pub current_position: usize,
}
Expand description
Cursor for navigating through a vector of tokens
This struct provides methods to access the current token, peek ahead or behind, and advance the cursor position.
§Fields
tokens
- A vector of tokens to navigate through.current_position
- The current position of the cursor within the token vector.
Fields§
§tokens: Vec<Token>
§current_position: usize
Implementations§
Source§impl TokenCursor
impl TokenCursor
Sourcepub fn peek_ahead(&self, n: usize) -> Option<&Token>
pub fn peek_ahead(&self, n: usize) -> Option<&Token>
Sourcepub fn _peek_behind(&self, n: usize) -> Option<&Token>
pub fn _peek_behind(&self, n: usize) -> Option<&Token>
Sourcepub fn _set_position(&mut self, pos: usize)
pub fn _set_position(&mut self, pos: usize)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TokenCursor
impl RefUnwindSafe for TokenCursor
impl Send for TokenCursor
impl Sync for TokenCursor
impl Unpin for TokenCursor
impl UnwindSafe for TokenCursor
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