pub trait TryToTokens {
    // Required method
    fn try_to_tokens(&self, tokens: &mut TokenStream) -> Result<(), Diagnostic>;

    // Provided method
    fn try_to_token_stream(&self) -> Result<TokenStream, Diagnostic> { ... }
}
Expand description

A trait for converting AST structs into Tokens and adding them to a TokenStream, or providing a diagnostic if conversion fails.

Required Methods§

source

fn try_to_tokens(&self, tokens: &mut TokenStream) -> Result<(), Diagnostic>

Attempt to convert a Self into tokens and add it to the TokenStream

Provided Methods§

source

fn try_to_token_stream(&self) -> Result<TokenStream, Diagnostic>

Attempt to convert a Self into a new TokenStream

Implementors§