pub(super) enum Item<'a> {
Literal(Spanned<&'a [u8]>),
EscapedBracket {
_first: Unused<Location>,
_second: Unused<Location>,
},
Component {
_opening_bracket: Unused<Location>,
_leading_whitespace: Unused<Option<Spanned<&'a [u8]>>>,
name: Spanned<&'a [u8]>,
modifiers: Box<[Modifier<'a>]>,
_trailing_whitespace: Unused<Option<Spanned<&'a [u8]>>>,
_closing_bracket: Unused<Location>,
},
Optional {
opening_bracket: Location,
_leading_whitespace: Unused<Option<Spanned<&'a [u8]>>>,
_optional_kw: Unused<Spanned<&'a [u8]>>,
_whitespace: Unused<Spanned<&'a [u8]>>,
nested_format_description: NestedFormatDescription<'a>,
closing_bracket: Location,
},
First {
opening_bracket: Location,
_leading_whitespace: Unused<Option<Spanned<&'a [u8]>>>,
_first_kw: Unused<Spanned<&'a [u8]>>,
_whitespace: Unused<Spanned<&'a [u8]>>,
nested_format_descriptions: Box<[NestedFormatDescription<'a>]>,
closing_bracket: Location,
},
}
Expand description
One part of a complete format description.
Variants§
Literal(Spanned<&'a [u8]>)
A literal string, formatted and parsed as-is.
This should never be present inside a nested format description.
EscapedBracket
A sequence of brackets. The first acts as the escape character.
This should never be present if the lexer has BACKSLASH_ESCAPE
set to true
.
Component
Part of a type, along with its modifiers.
Fields
_leading_whitespace: Unused<Option<Spanned<&'a [u8]>>>
Whitespace between the opening bracket and name.
Optional
An optional sequence of items.
Fields
_leading_whitespace: Unused<Option<Spanned<&'a [u8]>>>
Whitespace between the opening bracket and “optional”.
_whitespace: Unused<Spanned<&'a [u8]>>
Whitespace between the “optional” keyword and the opening bracket.
nested_format_description: NestedFormatDescription<'a>
The items within the optional sequence.
First
The first matching parse of a sequence of items.
Fields
_leading_whitespace: Unused<Option<Spanned<&'a [u8]>>>
Whitespace between the opening bracket and “first”.
_whitespace: Unused<Spanned<&'a [u8]>>
Whitespace between the “first” keyword and the opening bracket.
nested_format_descriptions: Box<[NestedFormatDescription<'a>]>
The sequences of items to try.