sway_parse

Trait Parse

Source
pub trait Parse {
    const FALLBACK_ERROR: ParseErrorKind = ParseErrorKind::InvalidItem;

    // Required method
    fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>
       where Self: Sized;

    // Provided method
    fn error(_spans: Box<[Span]>, _error: ErrorEmitted) -> Option<Self>
       where Self: Sized { ... }
}

Provided Associated Constants§

Source

const FALLBACK_ERROR: ParseErrorKind = ParseErrorKind::InvalidItem

Required Methods§

Source

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>
where Self: Sized,

Provided Methods§

Source

fn error(_spans: Box<[Span]>, _error: ErrorEmitted) -> Option<Self>
where Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Parse for AttributeHashKind

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for Expr

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Expr, ErrorEmitted>

Source§

impl Parse for IfCondition

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<IfCondition, ErrorEmitted>

Source§

impl Parse for MatchBranchKind

Source§

impl Parse for ItemKind

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemKind, ErrorEmitted>

Source§

fn error(spans: Box<[Span]>, error: ErrorEmitted) -> Option<Self>
where Self: Sized,

Source§

impl Parse for ItemImplItem

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemImplItem, ErrorEmitted>

Source§

impl Parse for ItemTraitItem

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemTraitItem, ErrorEmitted>

Source§

fn error(spans: Box<[Span]>, error: ErrorEmitted) -> Option<Self>
where Self: Sized,

Source§

impl Parse for UseTree

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<UseTree, ErrorEmitted>

Source§

impl Parse for Literal

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Literal, ErrorEmitted>

Source§

impl Parse for ModuleKind

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for Pattern

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Pattern, ErrorEmitted>

Source§

impl Parse for PatternStructField

Source§

fn parse( parser: &mut Parser<'_, '_>, ) -> Result<PatternStructField, ErrorEmitted>

Source§

impl Parse for Ty

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Ty, ErrorEmitted>

Source§

impl Parse for ()

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<(), ErrorEmitted>

Source§

impl Parse for Attribute

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AttributeArg

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AttributeDecl

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AsmBlock

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<AsmBlock, ErrorEmitted>

Source§

impl Parse for AsmImmediate

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<AsmImmediate, ErrorEmitted>

Source§

impl Parse for AsmRegisterDeclaration

Source§

impl Parse for ExprStructField

Source§

impl Parse for IfExpr

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<IfExpr, ErrorEmitted>

Source§

impl Parse for MatchBranch

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<MatchBranch, ErrorEmitted>

Source§

impl Parse for GenericArgs

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<GenericArgs, ErrorEmitted>

Source§

impl Parse for GenericParams

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<GenericParams, ErrorEmitted>

Source§

impl Parse for ItemAbi

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemAbi, ErrorEmitted>

Source§

impl Parse for ConfigurableField

Source§

impl Parse for ItemConfigurable

Source§

impl Parse for ItemConst

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemConst, ErrorEmitted>

Source§

impl Parse for ItemEnum

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemEnum, ErrorEmitted>

Source§

impl Parse for ItemFn

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemFn, ErrorEmitted>

Source§

impl Parse for ItemImpl

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemImpl, ErrorEmitted>

Source§

impl Parse for ItemStorage

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemStorage, ErrorEmitted>

Source§

impl Parse for StorageEntry

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<StorageEntry, ErrorEmitted>

Source§

impl Parse for StorageField

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<StorageField, ErrorEmitted>

Source§

impl Parse for ItemStruct

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemStruct, ErrorEmitted>

Source§

impl Parse for ItemTrait

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemTrait, ErrorEmitted>

Source§

impl Parse for Traits

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Traits, ErrorEmitted>

Source§

impl Parse for ItemTypeAlias

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemTypeAlias, ErrorEmitted>

Source§

impl Parse for ItemUse

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<ItemUse, ErrorEmitted>

Source§

impl Parse for FnArg

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<FnArg, ErrorEmitted>

Source§

impl Parse for FnSignature

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<FnSignature, ErrorEmitted>

Source§

impl Parse for TraitType

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<TraitType, ErrorEmitted>

Source§

impl Parse for TypeField

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<TypeField, ErrorEmitted>

Source§

impl Parse for AbiToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AddEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AddToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AmpersandToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AsToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for AsmToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for BangEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for BangToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for BreakToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for CaretToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ClassToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for CloseAngleBracketToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ColonToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for CommaToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ConfigurableToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ConstToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ContinueToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ContractToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DivEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DotToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DoubleAmpersandToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DoubleColonToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DoubleDotToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DoubleEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DoublePipeToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for DoubleStarToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ElseToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for EnumToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for EqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for FalseToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for FatRightArrowToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for FnToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ForToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ForwardSlashToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for GreaterThanEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for GreaterThanToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for HashBangToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for HashToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for IfToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ImplToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for InToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for LessThanEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for LessThanToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for LetToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for LibraryToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for MatchToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ModToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for MutToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for OpenAngleBracketToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for PercentToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for PipeToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for PredicateToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for PtrToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for PubToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for RefToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ReturnToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for RightArrowToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ScriptToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for SelfToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for SemicolonToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ShlEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ShlToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ShrEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for ShrToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for SliceToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for StarEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for StarToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for StorageToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for StrToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for StructToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for SubEqToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for SubToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for TraitToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for TrueToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for TypeToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for UnderscoreToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for UseToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for WhereToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for WhileToken

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for PathExpr

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<PathExpr, ErrorEmitted>

Source§

impl Parse for PathExprSegment

Source§

impl Parse for PathType

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<PathType, ErrorEmitted>

Source§

impl Parse for PathTypeSegment

Source§

impl Parse for QualifiedPathRoot

Source§

impl Parse for StatementLet

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

impl Parse for Submodule

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Submodule, ErrorEmitted>

Source§

impl Parse for DocComment

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<DocComment, ErrorEmitted>

Source§

impl Parse for WhereClause

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<WhereClause, ErrorEmitted>

Source§

impl Parse for Ident

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Ident, ErrorEmitted>

Source§

impl<T0> Parse for (T0,)
where T0: Parse,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<(T0,), ErrorEmitted>

Source§

impl<T0, T1> Parse for (T0, T1)
where T0: Parse, T1: Parse,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<(T0, T1), ErrorEmitted>

Source§

impl<T0, T1, T2> Parse for (T0, T1, T2)
where T0: Parse, T1: Parse, T2: Parse,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<(T0, T1, T2), ErrorEmitted>

Source§

impl<T0, T1, T2, T3> Parse for (T0, T1, T2, T3)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse,

Source§

impl<T0, T1, T2, T3, T4> Parse for (T0, T1, T2, T3, T4)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5> Parse for (T0, T1, T2, T3, T4, T5)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Parse for (T0, T1, T2, T3, T4, T5, T6)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse, T6: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Parse for (T0, T1, T2, T3, T4, T5, T6, T7)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse, T6: Parse, T7: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> Parse for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse, T6: Parse, T7: Parse, T8: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Parse for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse, T6: Parse, T7: Parse, T8: Parse, T9: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Parse for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse, T6: Parse, T7: Parse, T8: Parse, T9: Parse, T10: Parse,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Parse for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
where T0: Parse, T1: Parse, T2: Parse, T3: Parse, T4: Parse, T5: Parse, T6: Parse, T7: Parse, T8: Parse, T9: Parse, T10: Parse, T11: Parse,

Source§

impl<T> Parse for Box<T>
where T: Parse,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Box<T>, ErrorEmitted>

Source§

impl<T> Parse for Braces<T>
where T: ParseToEnd,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Braces<T>, ErrorEmitted>

Source§

impl<T> Parse for Parens<T>
where T: ParseToEnd,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Parens<T>, ErrorEmitted>

Source§

impl<T> Parse for SquareBrackets<T>
where T: ParseToEnd,

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<SquareBrackets<T>, ErrorEmitted>

Source§

impl<T: Parse> Parse for Annotated<T>

Source§

fn parse(parser: &mut Parser<'_, '_>) -> Result<Self, ErrorEmitted>

Source§

fn error(spans: Box<[Span]>, error: ErrorEmitted) -> Option<Self>
where Self: Sized,

Implementors§