Function syn::parse2

source · []
pub fn parse2<T: Parse>(tokens: TokenStream) -> Result<T>
Expand description

Parse a proc-macro2 token stream into the chosen syntax tree node.

This function parses a proc_macro2::TokenStream which is commonly useful when the input comes from a node of the Syn syntax tree, for example the body tokens of a Macro node. When in a procedural macro parsing the proc_macro::TokenStream provided by the compiler, use syn::parse instead.

This function is available only if Syn is built with the "parsing" feature.