Struct EventReader

Source
pub struct EventReader<'a, S: Iterator<Item = &'a u8>> { /* private fields */ }
Expand description

A wrapper around an Iterator which provides pull-based XML parsing.

Implementations§

Source§

impl<'a, S: Iterator<Item = &'a u8>> EventReader<'a, S>

Source

pub fn new(source: S) -> EventReader<'a, S>

Creates a new reader from an Iterator.

Source

pub fn new_with_config( source: S, config: impl Into<ParserConfig2>, ) -> EventReader<'a, S>

Creates a new reader with the provided configuration from an Iterator.

Source

pub fn next(&mut self) -> Result<XmlEvent>

Pulls and returns next XML event from the Iterator.

If returned event is XmlEvent::Error or XmlEvent::EndDocument, then further calls to this method will return this event again.

Source

pub fn skip(&mut self) -> Result<()>

Skips all XML events until the next end tag at the current level.

Convenience function that is useful for the case where you have encountered a start tag that is of no interest and want to skip the entire XML subtree until the corresponding end tag.

Source

pub fn source(&self) -> &S

Source

pub fn source_mut(&mut self) -> &mut S

Source

pub fn into_inner(self) -> S

Unwraps this EventReader, returning the underlying Iterator.

Source§

impl<'a> EventReader<'a, Iter<'a, u8>>

Source

pub fn from_str(source: &str) -> EventReader<'_, Iter<'_, u8>>

A convenience method to create an XmlReader from a string slice.

Trait Implementations§

Source§

impl<'a, S: Iterator<Item = &'a u8>> IntoIterator for EventReader<'a, S>

Source§

type Item = Result<XmlEvent, Error>

The type of the elements being iterated over.
Source§

type IntoIter = Events<'a, S>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Events<'a, S>

Creates an iterator from a value. Read more
Source§

impl<'a, S: Iterator<Item = &'a u8>> Position for EventReader<'a, S>

Source§

fn position(&self) -> TextPosition

Returns the position of the last event produced by the reader.

Auto Trait Implementations§

§

impl<'a, S> Freeze for EventReader<'a, S>
where S: Freeze,

§

impl<'a, S> RefUnwindSafe for EventReader<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for EventReader<'a, S>
where S: Send,

§

impl<'a, S> Sync for EventReader<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for EventReader<'a, S>
where S: Unpin,

§

impl<'a, S> UnwindSafe for EventReader<'a, S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.