DomParserExt

Trait DomParserExt 

Source
pub trait DomParserExt<'de>: DomParser<'de> {
    // Provided methods
    fn next_event_or_eof(
        &mut self,
        expected: &'static str,
    ) -> Result<DomEvent<'de>, DomDeserializeError<Self::Error>> { ... }
    fn peek_event_or_eof(
        &mut self,
        expected: &'static str,
    ) -> Result<&DomEvent<'de>, DomDeserializeError<Self::Error>> { ... }
    fn expect_node_start(
        &mut self,
    ) -> Result<Cow<'de, str>, DomDeserializeError<Self::Error>> { ... }
    fn expect_children_start(
        &mut self,
    ) -> Result<(), DomDeserializeError<Self::Error>> { ... }
    fn expect_children_end(
        &mut self,
    ) -> Result<(), DomDeserializeError<Self::Error>> { ... }
    fn expect_node_end(
        &mut self,
    ) -> Result<(), DomDeserializeError<Self::Error>> { ... }
    fn expect_text(
        &mut self,
    ) -> Result<Cow<'de, str>, DomDeserializeError<Self::Error>> { ... }
    fn expect_attribute(
        &mut self,
    ) -> Result<AttributeRecord<'de>, DomDeserializeError<Self::Error>> { ... }
    fn expect_comment(
        &mut self,
    ) -> Result<Cow<'de, str>, DomDeserializeError<Self::Error>> { ... }
}
Expand description

Extension trait adding convenience methods to any DomParser.

Provided Methods§

Source

fn next_event_or_eof( &mut self, expected: &'static str, ) -> Result<DomEvent<'de>, DomDeserializeError<Self::Error>>

Get the next event, returning an error if EOF.

Source

fn peek_event_or_eof( &mut self, expected: &'static str, ) -> Result<&DomEvent<'de>, DomDeserializeError<Self::Error>>

Peek at the next event, returning an error if EOF.

Source

fn expect_node_start( &mut self, ) -> Result<Cow<'de, str>, DomDeserializeError<Self::Error>>

Expect and consume a NodeStart event, returning the tag name.

Source

fn expect_children_start( &mut self, ) -> Result<(), DomDeserializeError<Self::Error>>

Expect and consume a ChildrenStart event.

Source

fn expect_children_end( &mut self, ) -> Result<(), DomDeserializeError<Self::Error>>

Expect and consume a ChildrenEnd event.

Source

fn expect_node_end(&mut self) -> Result<(), DomDeserializeError<Self::Error>>

Expect and consume a NodeEnd event.

Source

fn expect_text( &mut self, ) -> Result<Cow<'de, str>, DomDeserializeError<Self::Error>>

Expect and consume a Text event, returning the text content.

Source

fn expect_attribute( &mut self, ) -> Result<AttributeRecord<'de>, DomDeserializeError<Self::Error>>

Expect and consume an Attribute event, returning (name, value, namespace).

Source

fn expect_comment( &mut self, ) -> Result<Cow<'de, str>, DomDeserializeError<Self::Error>>

Expect and consume a Comment event, returning the comment text.

Implementors§

Source§

impl<'de, P: DomParser<'de>> DomParserExt<'de> for P