[][src]Trait syn::synom::Synom

pub trait Synom: Sized {
    fn parse(input: Cursor) -> PResult<Self>;

    fn description() -> Option<&'static str> { ... }
}

Parsing interface implemented by all types that can be parsed in a default way from a token stream.

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

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

Required methods

fn parse(input: Cursor) -> PResult<Self>

Loading content...

Provided methods

fn description() -> Option<&'static str>

A short name of the type being parsed.

The description should only be used for a simple name. It should not contain newlines or sentence-ending punctuation, to facilitate embedding in larger user-facing strings. Syn will use this description when building error messages about parse failures.

Examples

struct ExprMacro {
    // ...
}

impl Synom for ExprMacro {
    // fn parse(...) -> ... { ... }

    fn description() -> Option<&'static str> {
        // Will result in messages like
        //
        //     "failed to parse macro invocation expression: $reason"
        Some("macro invocation expression")
    }
}
Loading content...

Implementations on Foreign Types

impl Synom for TokenStream[src]

Loading content...

Implementors

impl Synom for BareFnArgName[src]

impl Synom for Expr[src]

impl Synom for GenericArgument[src]

impl Synom for GenericParam[src]

impl Synom for Lit[src]

impl Synom for ReturnType[src]

impl Synom for TraitBoundModifier[src]

impl Synom for syn::Type[src]

impl Synom for TypeParamBound[src]

impl Synom for UnOp[src]

impl Synom for Visibility[src]

impl Synom for WherePredicate[src]

impl Synom for Abi[src]

impl Synom for AngleBracketedGenericArguments[src]

impl Synom for BareFnArg[src]

impl Synom for Binding[src]

impl Synom for BoundLifetimes[src]

impl Synom for ConstParam[src]

impl Synom for DeriveInput[src]

impl Synom for ExprLit[src]

impl Synom for ExprParen[src]

impl Synom for ExprPath[src]

impl Synom for FieldsNamed[src]

impl Synom for FieldsUnnamed[src]

impl Synom for Generics[src]

impl Synom for Ident[src]

impl Synom for Lifetime[src]

impl Synom for LifetimeDef[src]

impl Synom for LitBool[src]

impl Synom for LitByte[src]

impl Synom for LitByteStr[src]

impl Synom for LitChar[src]

impl Synom for LitFloat[src]

impl Synom for LitInt[src]

impl Synom for LitStr[src]

impl Synom for syn::Macro[src]

impl Synom for ParenthesizedGenericArguments[src]

impl Synom for Path[src]

impl Synom for PathSegment[src]

impl Synom for TraitBound[src]

impl Synom for TypeArray[src]

impl Synom for TypeBareFn[src]

impl Synom for TypeGroup[src]

impl Synom for TypeImplTrait[src]

impl Synom for TypeInfer[src]

impl Synom for TypeMacro[src]

impl Synom for TypeNever[src]

impl Synom for TypeParam[src]

impl Synom for TypeParen[src]

impl Synom for TypePath[src]

impl Synom for TypePtr[src]

impl Synom for TypeReference[src]

impl Synom for TypeSlice[src]

impl Synom for TypeTraitObject[src]

impl Synom for TypeTuple[src]

impl Synom for Variant[src]

impl Synom for WhereClause[src]

impl Synom for Add[src]

impl Synom for AddEq[src]

impl Synom for And[src]

impl Synom for AndAnd[src]

impl Synom for AndEq[src]

impl Synom for As[src]

impl Synom for At[src]

impl Synom for Auto[src]

impl Synom for Bang[src]

impl Synom for Box[src]

impl Synom for Break[src]

impl Synom for CapSelf[src]

impl Synom for Caret[src]

impl Synom for CaretEq[src]

impl Synom for Catch[src]

impl Synom for Colon[src]

impl Synom for Colon2[src]

impl Synom for Comma[src]

impl Synom for Const[src]

impl Synom for Continue[src]

impl Synom for Crate[src]

impl Synom for Default[src]

impl Synom for Div[src]

impl Synom for DivEq[src]

impl Synom for Do[src]

impl Synom for Dot[src]

impl Synom for Dot2[src]

impl Synom for Dot3[src]

impl Synom for DotDotEq[src]

impl Synom for Dyn[src]

impl Synom for Else[src]

impl Synom for Enum[src]

impl Synom for Eq[src]

impl Synom for EqEq[src]

impl Synom for Extern[src]

impl Synom for Fn[src]

impl Synom for For[src]

impl Synom for Ge[src]

impl Synom for Gt[src]

impl Synom for If[src]

impl Synom for Impl[src]

impl Synom for In[src]

impl Synom for LArrow[src]

impl Synom for Le[src]

impl Synom for Let[src]

impl Synom for Loop[src]

impl Synom for Lt[src]

impl Synom for syn::token::Macro[src]

impl Synom for Match[src]

impl Synom for Mod[src]

impl Synom for Move[src]

impl Synom for MulEq[src]

impl Synom for Mut[src]

impl Synom for Ne[src]

impl Synom for Or[src]

impl Synom for OrEq[src]

impl Synom for OrOr[src]

impl Synom for Pound[src]

impl Synom for Pub[src]

impl Synom for Question[src]

impl Synom for RArrow[src]

impl Synom for Ref[src]

impl Synom for Rem[src]

impl Synom for RemEq[src]

impl Synom for Return[src]

impl Synom for Rocket[src]

impl Synom for Self_[src]

impl Synom for Semi[src]

impl Synom for Shl[src]

impl Synom for ShlEq[src]

impl Synom for Shr[src]

impl Synom for ShrEq[src]

impl Synom for Star[src]

impl Synom for Static[src]

impl Synom for Struct[src]

impl Synom for Sub[src]

impl Synom for SubEq[src]

impl Synom for Super[src]

impl Synom for Trait[src]

impl Synom for syn::token::Type[src]

impl Synom for Underscore[src]

impl Synom for Union[src]

impl Synom for Unsafe[src]

impl Synom for Use[src]

impl Synom for Where[src]

impl Synom for While[src]

impl Synom for Yield[src]

Loading content...