Struct XmlReader

Source
struct XmlReader<'i, R: XmlRead<'i>, E: EntityResolver = PredefinedEntityResolver> {
    reader: R,
    lookahead: Result<PayloadEvent<'i>, DeError>,
    entity_resolver: E,
}
Expand description

An intermediate reader that consumes PayloadEvents and produces final DeEvents. PayloadEvent::Text events, that followed by any event except PayloadEvent::Text or PayloadEvent::CData, are trimmed from the end.

Fields§

§reader: R

A source of low-level XML events

§lookahead: Result<PayloadEvent<'i>, DeError>

Intermediate event, that could be returned by the next call to next(). If that is the Text event then leading spaces already trimmed, but trailing spaces is not. Before the event will be returned, trimming of the spaces could be necessary

§entity_resolver: E

Used to resolve unknown entities that would otherwise cause the parser to return an EscapeError::UnrecognizedEntity error.

Implementations§

Source§

impl<'i, R: XmlRead<'i>, E: EntityResolver> XmlReader<'i, R, E>

Source

fn new(reader: R, entity_resolver: E) -> Self

Source

const fn is_empty(&self) -> bool

Returns true if all events was consumed

Source

fn next_impl(&mut self) -> Result<PayloadEvent<'i>, DeError>

Read next event and put it in lookahead, return the current lookahead

Source

const fn current_event_is_last_text(&self) -> bool

Returns true when next event is not a text event in any form.

Source

fn drain_text(&mut self, result: Cow<'i, str>) -> Result<DeEvent<'i>, DeError>

Read all consequent Text and CData events until non-text event occurs. Content of all events would be appended to result and returned as DeEvent::Text.

Source

fn next(&mut self) -> Result<DeEvent<'i>, DeError>

Return an input-borrowing event.

Source

fn read_to_end(&mut self, name: QName<'_>) -> Result<(), DeError>

Source

fn decoder(&self) -> Decoder

Auto Trait Implementations§

§

impl<'i, R, E> Freeze for XmlReader<'i, R, E>
where R: Freeze, E: Freeze,

§

impl<'i, R, E = PredefinedEntityResolver> !RefUnwindSafe for XmlReader<'i, R, E>

§

impl<'i, R, E> Send for XmlReader<'i, R, E>
where R: Send, E: Send,

§

impl<'i, R, E> Sync for XmlReader<'i, R, E>
where R: Sync, E: Sync,

§

impl<'i, R, E> Unpin for XmlReader<'i, R, E>
where R: Unpin, E: Unpin,

§

impl<'i, R, E = PredefinedEntityResolver> !UnwindSafe for XmlReader<'i, R, E>

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.