TreeIterExt

Trait TreeIterExt 

Source
pub trait TreeIterExt {
    // Required methods
    fn collect_til_punct(&mut self, _: char) -> Vec<TokenTree>;
    fn skip_puncts(&mut self, _: &str) -> Vec<TokenTree>;
    fn next_if_num(&mut self) -> Option<Literal>;
    fn try_next_float(&mut self) -> Option<(f32, LitFloat)>;
    fn peek_punct(&mut self) -> char;
    fn split_punct(self, _: char) -> Vec<TokenStream>;
}
Expand description

This is an extension trait for the following impl:

#[extension(pub trait TreeIterExt)]
impl for PeekIter

Required Methods§

Source

fn collect_til_punct(&mut self, _: char) -> Vec<TokenTree>

Source

fn skip_puncts(&mut self, _: &str) -> Vec<TokenTree>

skip until [Self::next()] isn’t a TokenTree::Punct

Source

fn next_if_num(&mut self) -> Option<Literal>

only progress iter if next is a numeric literal & return it

Source

fn try_next_float(&mut self) -> Option<(f32, LitFloat)>

Source

fn peek_punct(&mut self) -> char

get next punct as char without progressing iter, if not a punct its a 'n'

Source

fn split_punct(self, _: char) -> Vec<TokenStream>

splits Tokens into multiple TokenStreams by a char delimiter.

  • doesn’t include empty parts.

Implementors§