Trait TokenStreamExt

Source
pub trait TokenStreamExt:
    Default
    + Extend<TokenTree>
    + Extend<TokenStream>
    + IntoIterator<Item = TokenTree>
    + Sized {
    // Required methods
    fn grouped(self, delimiter: Delimiter) -> Group;
    fn split_puncts(
        self,
        puncts: impl AsRef<[u8]>,
    ) -> Option<(Self, ParseIter<Self::IntoIter>)>;
    fn split_puncts_all(self, puncts: impl AsRef<[u8]>) -> Vec<Self>;

    // Provided methods
    fn push(&mut self, tt: TokenTree) -> &mut Self { ... }
    fn add(&mut self, stream: TokenStream) -> &mut Self { ... }
    fn take(&mut self) -> Self { ... }
    fn grouped_paren(self) -> Group { ... }
    fn grouped_brace(self) -> Group { ... }
    fn grouped_bracket(self) -> Group { ... }
    fn grouped_none(self) -> Group { ... }
}

Required Methods§

Source

fn grouped(self, delimiter: Delimiter) -> Group

Source

fn split_puncts( self, puncts: impl AsRef<[u8]>, ) -> Option<(Self, ParseIter<Self::IntoIter>)>

Split TokenStream with puncts

Like "+-,-+".split_puncts(",") -> ("+-", "-+")

Source

fn split_puncts_all(self, puncts: impl AsRef<[u8]>) -> Vec<Self>

Split all TokenStream with puncts

Like "+-,-+".split_puncts_all(",") -> "+-", "-+"

Provided Methods§

Source

fn push(&mut self, tt: TokenTree) -> &mut Self

Extend a TokenTree

Source

fn add(&mut self, stream: TokenStream) -> &mut Self

Extend a TokenStream

Source

fn take(&mut self) -> Self

Call mem::take

Source

fn grouped_paren(self) -> Group

Source

fn grouped_brace(self) -> Group

Source

fn grouped_bracket(self) -> Group

Source

fn grouped_none(self) -> Group

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TokenStreamExt for TokenStream

Source§

fn grouped(self, delimiter: Delimiter) -> Group

Source§

fn split_puncts( self, puncts: impl AsRef<[u8]>, ) -> Option<(Self, ParseIter<Self::IntoIter>)>

Source§

fn split_puncts_all(self, puncts: impl AsRef<[u8]>) -> Vec<Self>

Implementors§