Skip to main content

ParsableXmlDocument

Trait ParsableXmlDocument 

Source
pub trait ParsableXmlDocument: Sized {
    type Error;

    // Required method
    fn parse<R>(reader: &mut EventReader<R>) -> Result<Self, Self::Error>
       where R: Read;

    // Provided method
    fn parse_from_bytes(xml: impl AsRef<[u8]>) -> Result<Self, Self::Error> { ... }
}
Expand description

Represents a root element which can be parsed from XML.

Required Associated Types§

Source

type Error

The error type that can be returned when parsing fails.

Required Methods§

Source

fn parse<R>(reader: &mut EventReader<R>) -> Result<Self, Self::Error>
where R: Read,

Parse the XML document from the given XML reader.

Provided Methods§

Source

fn parse_from_bytes(xml: impl AsRef<[u8]>) -> Result<Self, Self::Error>

Parse the XML document from the given bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§