pub struct Cursor<'a> { /* private fields */ }Expand description
Cursor for recursive descent
Implementations§
Source§impl<'a> Cursor<'a>
impl<'a> Cursor<'a>
pub fn new(trees: &'a [TokenTree]) -> Self
Sourcepub fn peek(&self) -> Option<&'a TokenTree>
pub fn peek(&self) -> Option<&'a TokenTree>
Peek the next token without moving the cursor forward
pub fn peek_token(&self) -> Option<&'a TokenTreeToken>
pub fn peek_block(&self) -> Option<&'a TokenTreeBlock>
Sourcepub fn next(&mut self) -> Option<&'a TokenTree>
pub fn next(&mut self) -> Option<&'a TokenTree>
Advances the cursor and returns the next value.
pub fn next_token(&mut self) -> Option<&'a TokenTreeToken>
pub fn next_block(&mut self) -> Option<&'a TokenTreeBlock>
Sourcepub fn skip_next_block_of(&mut self, delimiter: Block) -> Option<()>
pub fn skip_next_block_of(&mut self, delimiter: Block) -> Option<()>
Skip the next block to not descent down into
pub fn enter_block_of(&mut self, delimiter: Block) -> Option<&'a TokenTreeBlock>
pub fn fork(&self) -> Self
Sourcepub fn last_location(&self) -> Range<usize>
pub fn last_location(&self) -> Range<usize>
Get the location of the cursor
pub fn next_location(&self) -> Range<usize>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Cursor<'a>
impl<'a> RefUnwindSafe for Cursor<'a>
impl<'a> Send for Cursor<'a>
impl<'a> Sync for Cursor<'a>
impl<'a> Unpin for Cursor<'a>
impl<'a> UnwindSafe for Cursor<'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