Trait proclet::GroupExt

source ·
pub trait GroupExt: ProcMacroExt<GroupExt = Self> + Group + Parse<Self::TokenTree> + IntoTokens<Self::TokenTree> + ToTokens<Self::TokenTree> + ToTokenStream<Self::TokenStream> {
    // Required method
    fn stream_buffer(&self) -> TokenBuffer<Self::TokenTree>;

    // Provided methods
    fn with_span(
        delimiter: Self::Delimiter,
        stream: Self::TokenStream,
        span: Self::Span
    ) -> Self { ... }
    fn delimiter_kind(&self) -> DelimiterKind { ... }
    fn flatten(&self) -> Option<Self::TokenTree> { ... }
}
Expand description

Extensions for Group.

This trait is implemented for Group in proc_macro and proc_macro2 if the corresponding feature is enabled.

Required Methods§

source

fn stream_buffer(&self) -> TokenBuffer<Self::TokenTree>

Get the punctuated TokenStream as a TokenBuffer, not including delimiters.

Provided Methods§

source

fn with_span( delimiter: Self::Delimiter, stream: Self::TokenStream, span: Self::Span ) -> Self

Create a new Group with a custom span.

source

fn delimiter_kind(&self) -> DelimiterKind

Get the delimiter of this Group as a matchable enum.

source

fn flatten(&self) -> Option<Self::TokenTree>

If the group has delimiter None and contains a single item, extract that item, and if that item is a group, flatten that too, recursively. Then return the item, or None if the conditions weren’t met.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl GroupExt for Group

Available on crate feature proc-macro only.
source§

impl GroupExt for Group

Available on crate feature proc-macro2 only.

Implementors§