pub trait ToTokens {
// Required method
fn to_tokens(&self, tokens: &mut TokenStream);
// Provided methods
fn to_token_stream(&self) -> TokenStream { ... }
fn into_token_stream(self) -> TokenStream
where Self: Sized { ... }
}
Expand description
A trait for converting types into a TokenStream
.
See the module documentation for more information.
Required Methods§
Sourcefn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Append self
to the given TokenStream
.
Provided Methods§
Sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Convert self
directly into a TokenStream
.
Sourcefn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Convert self
directly into a TokenStream
.
Implementations on Foreign Types§
Source§impl ToTokens for TokenStream
Available on crate feature proc-macro2
only.
impl ToTokens for TokenStream
Available on crate feature
proc-macro2
only.