pub struct TokenIter { /* private fields */ }Expand description
A wrapper for TokenStream that allows for 1-token lookahead, and records the current and last Spans.
Implementations§
Source§impl TokenIter
impl TokenIter
pub fn from(ts: TokenStream, start_span: Span) -> Self
Sourcepub fn next(&mut self) -> Option<TokenTree>
pub fn next(&mut self) -> Option<TokenTree>
Advance to the next token, and return Some(token) if present, otherwise return None and do not advance.
pub fn peek_next(&self) -> &Option<TokenTree>
Sourcepub fn cur_span(&self) -> &Span
pub fn cur_span(&self) -> &Span
The span of the last token from Self::next().
Sourcepub fn last_span(&self) -> &Option<Span>
pub fn last_span(&self) -> &Option<Span>
The span of the last, last token found from Self::next().
pub fn extract_iter(self) -> IntoIter
Auto Trait Implementations§
impl Freeze for TokenIter
impl RefUnwindSafe for TokenIter
impl !Send for TokenIter
impl !Sync for TokenIter
impl Unpin for TokenIter
impl UnwindSafe for TokenIter
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