[][src]Module xml_data::parser

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

IgnoreElement

Can be used as ElementState to ignore an element with all content (attributes and sub elements and text)

ParseElementList

InnerState to parse multiple occurences of a single element

ParseElementOnce

InnerState to parse a single element

ParseElementOptional

InnerState to parse a single optional element

ParseInnerOptional

InnerState to parse optional inner data; if it parsed anything it needs to finish

ValueDefault

Implements Value for all types implementing std::str::FromStr; this is a good default.

ValueString

Implements Value for String and Cow<str>.

Enums

InnerParseResult

Result of InnerState parse methods to signal whether they successfully parsed the input or another InnerState needs to take a shot.

Traits

Element

Parsable element

ElementParser

A parser that is ready to parse exactly one element (and nested data).

ElementParserExt

extend ElementParser trait with convenience methods

ElementState

A state to parse exactly one element

FixedElementState

Convenience trait to implement instead of ElementState if your element has a fixed tag.

Inner

Parsable inner data (multiple elements)

InnerState

State to parse multiple elements (on the same level)

Value

Trait to parse attributes and inner text

Type Definitions

ElementDefaultParseState

Type alias to find the default parse state for an Element

InnerDefaultParseState

Type alias to find the default parse state for an Inner

Derive Macros

Element

Derive xml-data::parser::Element

Inner

Derive xml-data::parser::Inner