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
Types that can be interpolated inside a quote!
invocation.
Required Methods§
Sourcefn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Write 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
object.
This method is implicitly implemented using to_tokens
, and acts as a
convenience method for consumers of the ToTokens
trait.
Sourcefn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Convert self
directly into a TokenStream
object.
This method is implicitly implemented using to_tokens
, and acts as a
convenience method for consumers of the ToTokens
trait.