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
ElementState
to ignore an element with all content (attributes and sub elements and text) - Parse
Element List InnerState
to parse multiple occurences of a single element- Parse
Element Once InnerState
to parse a single element- Parse
Element Optional InnerState
to parse a single optional element- Parse
Inner Optional InnerState
to parse optional inner data; if it parsed anything it needs to finish- Value
Default - Implements
Value
for all types implementingstd::str::FromStr
; this is a good default. - Value
String - Implements
Value
forString
andCow<str>
.
Enums§
- Inner
Parse Result - Result of
InnerState
parse methods to signal whether they successfully parsed the input or anotherInnerState
needs 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
ElementParser
trait with convenience methods - Element
State - A state to parse exactly one element
- Fixed
Element State - Convenience trait to implement instead of
ElementState
if 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