Expand description
Traits and helper structs to parse XML
To implement parsing for your data types (mapping to XML elements) you need intermediate
“state” types (implementing FixedElementState or ElementState), which work like “builders”:
they will receive the various parts incrementally until they can “build” the result.
To define a default state for your type (so it can be easily found in certain places) you need
to implement Element.
If your data type should represent multiple elements you need to a state type implementing
InnerState; the default state is defined by implementing Inner. If E implements
Element, E, Option<E>, and Vec<E> automatically implement Inner.
To implement parser adaptors for an XML library you need to implement ElementParser.
Structs§
- Ignore
Element - Can be used as
ElementStateto ignore an element with all content (attributes and sub elements and text) - Parse
Element List InnerStateto parse multiple occurences of a single element- Parse
Element Once InnerStateto parse a single element- Parse
Element Optional InnerStateto parse a single optional element- Parse
Inner Optional InnerStateto parse optional inner data; if it parsed anything it needs to finish- Value
Default - Implements
Valuefor all types implementingstd::str::FromStr; this is a good default. - Value
String - Implements
ValueforStringandCow<str>.
Enums§
- Inner
Parse Result - Result of
InnerStateparse methods to signal whether they successfully parsed the input or anotherInnerStateneeds to take a shot.
Traits§
- Element
- Parsable element
- Element
Parser - A parser that is ready to parse exactly one element (and nested data).
- Element
Parser Ext - extend
ElementParsertrait with convenience methods - Element
State - A state to parse exactly one element
- Fixed
Element State - Convenience trait to implement instead of
ElementStateif your element has a fixed tag. - Inner
- Parsable inner data (multiple elements)
- Inner
State - State to parse multiple elements (on the same level)
- Value
- Trait to parse attributes and inner text
Type Aliases§
- Element
Default Parse State - Type alias to find the default parse state for an
Element - Inner
Default Parse State - Type alias to find the default parse state for an
Inner