ParseUsingSubkeywords

Trait ParseUsingSubkeywords 

Source
pub trait ParseUsingSubkeywords: Sized + ParseOneSubkeyword {
    // Required method
    fn new_default(kw_span: Span) -> Result<Self>;

    // Provided method
    fn parse(input: ParseStream<'_>, kw_span: Span) -> Result<Self> { ... }
}
Expand description

Parse Self using named subkeyword arguments within the ${...}

Provides parse() in terms of:

  • An implementation of new_default() (which must generally be manually provided)
  • An implementation of ParseOneSubkeyword, usually made with impl_parse_subkeywords!.

Required Methods§

Source

fn new_default(kw_span: Span) -> Result<Self>

Make a new Self with default values for all parameters

This is used when the keyword is invoked without being enclosed in ${...}, and as the starting point when it is enclosed.

kw_span is to be used if to construct any SubstParseContext lexical context tokens (eg, NotInPaste) in Self.

Provided Methods§

Source

fn parse(input: ParseStream<'_>, kw_span: Span) -> Result<Self>

Parse the body of Self, processing names subkeyword arguments

kw_span is for the top-level keyword introducing Self.

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.

Implementors§