pub struct Cursor<'a, Span> { /* private fields */ }
Expand description
A safe version of Cursor
from syn
crate https://github.com/dtolnay/syn/blob/6533607f91686545cb034d2838beea338d9d0742/src/buffer.rs#L125
Implementations§
source§impl<'a, Span> Cursor<'a, Span>
impl<'a, Span> Cursor<'a, Span>
sourcepub fn end(self) -> Option<&'a Subtree<Span>>
pub fn end(self) -> Option<&'a Subtree<Span>>
If the cursor is pointing at the end of a subtree, returns the parent subtree
sourcepub fn subtree(self) -> Option<Cursor<'a, Span>>
pub fn subtree(self) -> Option<Cursor<'a, Span>>
If the cursor is pointing at a Subtree
, returns
a cursor into that subtree
sourcepub fn token_tree(self) -> Option<TokenTreeRef<'a, Span>>
pub fn token_tree(self) -> Option<TokenTreeRef<'a, Span>>
If the cursor is pointing at a TokenTree
, returns it
sourcepub fn bump_subtree(self) -> Cursor<'a, Span>
pub fn bump_subtree(self) -> Cursor<'a, Span>
Bump the cursor, if it is a subtree, returns a cursor into that subtree
Trait Implementations§
source§impl<Span> PartialEq for Cursor<'_, Span>
impl<Span> PartialEq for Cursor<'_, Span>
impl<'a, Span: Copy> Copy for Cursor<'a, Span>
impl<Span> Eq for Cursor<'_, Span>
Auto Trait Implementations§
impl<'a, Span> Freeze for Cursor<'a, Span>
impl<'a, Span> RefUnwindSafe for Cursor<'a, Span>where
Span: RefUnwindSafe,
impl<'a, Span> Send for Cursor<'a, Span>where
Span: Sync,
impl<'a, Span> Sync for Cursor<'a, Span>where
Span: Sync,
impl<'a, Span> Unpin for Cursor<'a, Span>
impl<'a, Span> UnwindSafe for Cursor<'a, Span>where
Span: RefUnwindSafe,
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more