impl_parse_one_subkeyword

Macro impl_parse_one_subkeyword 

Source
macro_rules! impl_parse_one_subkeyword {
    {
    $ty:ident $( < $O:ident > )?:
    $( ( $($spec:tt)+ ) ),* $(,)?
} => { ... };
    { @ $bind:tt @ $exp:ident } => { ... };
    { @ $bind:tt @ $exp:literal: . $($field:tt)+ } => { ... };
    { @ ($self:expr, $got:expr, $ps:expr) @ .. $($substruct:tt)+ } => { ... };
    { @@ ($self:expr, $got:expr, $ps:expr) @ $exp:expr, .$($field:tt)+ } => { ... };
}
Expand description

Implements ParseOneSubkeyword for the use of ParseUsingSubkeywords

Input syntax is TYPE: (SUBKEYWORD-SPEC), (SUBKEYWORD-SPEC), ... where each SUBKEYWORD-SPEC is one of:

  • (field): recognises "field" and stores in self.field.
  • ("subkw": .field): recognises "subkw"
  • (..substruct): calls self.substruct.process_one_keyword, thereby incorporating the sub-structure’s subkeywords

You can write TYPE<O>: ... which results in impl<O: SubstParseContext> ... for TYPE<O>.