Trait dae_parser::XNode[][src]

pub trait XNode: Sized {
    const NAME: &'static str;

    fn parse(element: &Element) -> Result<Self, Error>;

    fn parse_box(element: &Element) -> Result<Box<Self>, Error> { ... }
fn parse_one<'a>(
        it: &mut impl Iterator<Item = &'a Element>
    ) -> Result<Self, Error> { ... }
fn parse_opt(it: &mut Peekable<Children<'_>>) -> Result<Option<Self>, Error> { ... }
fn parse_opt_box(
        it: &mut Peekable<Children<'_>>
    ) -> Result<Option<Box<Self>>, Error> { ... }
fn parse_list(it: &mut Peekable<Children<'_>>) -> Result<Vec<Self>, Error> { ... }
fn parse_list_n<const N: usize>(
        it: &mut Peekable<Children<'_>>
    ) -> Result<Vec<Self>, Error> { ... } }
Expand description

A common trait for all data structures that represent an XML element.

Associated Constants

The name of the XML element.

Required methods

Parse an XML element into this type. In most cases, the parser will require with a debug_assert that the element to parse has name Self::NAME.

Provided methods

Parse an XML element and return the data structure in a Box. This can be faster in some cases when the data structure is large.

Parse a single required element from the given element iterator.

Parse an optional element from the given element iterator, using Self::NAME to determine if it is the correct type.

Parse an optional boxed element from the given element iterator, using Self::NAME to determine if it is the correct type.

Parse a list of elements from the given element iterator, as long as it continues yielding elements of name Self::NAME.

Parse a list of elements from the given element iterator, as long as it continues yielding elements of name Self::NAME, and assert that the resulting list has length at least N.

Implementors