[][src]Trait syn::synom::Parser

pub trait Parser: Sized {
    type Output;
    fn parse2(self, tokens: TokenStream) -> Result<Self::Output, ParseError>;

    fn parse(self, tokens: TokenStream) -> Result<Self::Output, ParseError> { ... }
fn parse_str(self, s: &str) -> Result<Self::Output, ParseError> { ... } }

Parser that can parse Rust tokens into a particular syntax tree node.

Refer to the module documentation for details about parsing in Syn.

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

Associated Types

type Output

Loading content...

Required methods

fn parse2(self, tokens: TokenStream) -> Result<Self::Output, ParseError>

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

Loading content...

Provided methods

fn parse(self, tokens: TokenStream) -> Result<Self::Output, ParseError>

Parse tokens of source code into the chosen syntax tree node.

fn parse_str(self, s: &str) -> Result<Self::Output, ParseError>

Parse a string of Rust code into the chosen syntax tree node.

Hygiene

Every span in the resulting syntax tree will be set to resolve at the macro call site.

Loading content...

Implementors

impl<F, T> Parser for F where
    F: FnOnce(Cursor) -> PResult<T>, 
[src]

type Output = T

Loading content...