pub struct GeneratedNodeTokens {
pub toplevel: TokenStream,
pub unnamed: TokenStream,
pub symbols: TokenStream,
pub anon_unions: AnonUnions,
}Expand description
Generated AST tokens from calling [NodeType::print] on a single instance or each element of a
collection.
We can’t just collect the output of [NodeType::print] into a TokenStream because some
declarations go in specific submodules (unnamed, symbols, anon_unions), and also we don’t want
duplicate definitions of the anonymous unions.
Fields§
§toplevel: TokenStreamToplevel declaration tokens
unnamed: TokenStreamTokens for the unnamed submodule
symbols: TokenStreamTokens for the symbols submodule
anon_unions: AnonUnionsAnonymous unions and tokens for the anon_union submodule
Implementations§
Source§impl GeneratedNodeTokens
impl GeneratedNodeTokens
Sourcepub fn append_tokens(&mut self, module: NodeModule, tokens: TokenStream)
pub fn append_tokens(&mut self, module: NodeModule, tokens: TokenStream)
Append the tokens to the given module
Sourcepub fn append(&mut self, other: GeneratedNodeTokens)
pub fn append(&mut self, other: GeneratedNodeTokens)
Append the other’s tokens into this
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Convert into a pretty-printed string.
Specifically, the code is formatted with prettyplease.
To convert not pretty-printed, use collapse then
display the returned TokenStream.
Source§impl GeneratedNodeTokens
impl GeneratedNodeTokens
Sourcepub fn collapse(self) -> TokenStream
pub fn collapse(self) -> TokenStream
Strip extra info, converting this into a regular TokenStream.
To pretty-print, call into_string.
Trait Implementations§
Source§impl Clone for GeneratedNodeTokens
impl Clone for GeneratedNodeTokens
Source§fn clone(&self) -> GeneratedNodeTokens
fn clone(&self) -> GeneratedNodeTokens
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GeneratedNodeTokens
impl Debug for GeneratedNodeTokens
Source§impl Default for GeneratedNodeTokens
impl Default for GeneratedNodeTokens
Source§fn default() -> GeneratedNodeTokens
fn default() -> GeneratedNodeTokens
Source§impl Extend<GeneratedNodeTokens> for GeneratedNodeTokens
impl Extend<GeneratedNodeTokens> for GeneratedNodeTokens
Source§fn extend<T: IntoIterator<Item = GeneratedNodeTokens>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = GeneratedNodeTokens>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)