ErrorReader

Struct ErrorReader 

Source
pub struct ErrorReader<R> { /* private fields */ }
Expand description

Implements a XmlReader that is able to provide additional error information like the current cursor position or the chain of currently processed XML tags.

Implementations§

Source§

impl<R> ErrorReader<R>
where R: XmlReader,

Source

pub fn new(inner: R) -> Self

Create a new ErrorReader instance from the passed reader.

Source

pub fn into_inner(self) -> R

Extracts the internal reader from the instance.

Trait Implementations§

Source§

impl<R: Debug> Debug for ErrorReader<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R> XmlReader for ErrorReader<R>
where R: XmlReader,

Source§

fn resolve<'n>( &self, name: QName<'n>, attribute: bool, ) -> (ResolveResult<'_>, LocalName<'n>)

Resolves a qname in the current context of the XML file.
Source§

fn namespaces(&self) -> NamespacesShared<'static>

Returns a map that contains all namespaces in the current context.
Source§

fn current_position(&self) -> u64

Returns the current position (byte offset) in the current XML file.
Source§

fn error_position(&self) -> u64

Returns the position (byte offset) of the last detected error.
Source§

fn extend_error(&self, error: Error) -> Error

Add the error position to the passed error and return it.
Source§

fn map_error<E>(&self, error: E) -> Error
where Error: From<E>,

Converts the passed error to an Error, adds the error information using extend_error and returns it.
Source§

fn map_result<T, E>(&self, result: Result<T, E>) -> Result<T, Error>
where Error: From<E>,

Same as map_error, but for the passed result.
Source§

fn err<E>(&self, error: E) -> Result<(), Error>
where Error: From<E>,

Create a result from the passed error using map_error and returns it.
Source§

fn with_error_info(self) -> ErrorReader<Self>

Wraps the current reader in a new ErrorReader.
Source§

impl<'a, R> XmlReaderSync<'a> for ErrorReader<R>
where R: XmlReaderSync<'a>,

Source§

fn read_event(&mut self) -> Result<Event<'a>, Error>

Reads the next Event from the reader. Read more
Source§

fn read_tag(&mut self) -> Result<Event<'a>, Error>

Reads a new XML tag (Event::Start, Event::Empty or Event::End) from the reader. Read more
Source§

fn skip_current(&mut self) -> Result<(), Error>

Skips the current event with respect to the level of the different XML tags. Read more

Auto Trait Implementations§

§

impl<R> Freeze for ErrorReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for ErrorReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for ErrorReader<R>
where R: Send,

§

impl<R> Sync for ErrorReader<R>
where R: Sync,

§

impl<R> Unpin for ErrorReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for ErrorReader<R>
where R: 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<X> AsAny for X
where X: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Get a reference to the current object as Any.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Get a mutable reference to the current object as Any.
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<X> DeserializeReader for X
where X: XmlReader,

Source§

fn read_attrib<T>( &self, store: &mut Option<T>, name: &'static [u8], value: &[u8], ) -> Result<(), Error>

Helper function to convert and store an attribute from the XML event. Read more
Source§

fn raise_unexpected_attrib(&self, attrib: Attribute<'_>) -> Result<(), Error>

Raise the UnexpectedAttribute error for the passed attrib. Read more
Source§

fn raise_unexpected_attrib_checked( &self, attrib: Attribute<'_>, ) -> Result<(), Error>

Raises an UnexpectedAttribute error for the given attribute if it is not globally allowed (e.g., an XSI attribute). Read more
Source§

fn is_globally_allowed_attrib(&self, attrib: &Attribute<'_>) -> bool

Returns true if the given attribute is a globally allowed XML Schema Instance (XSI) attribute, false otherwise. Read more
Source§

fn resolve_local_name<'a>(&self, name: QName<'a>, ns: &[u8]) -> Option<&'a [u8]>

Try to resolve the local name of the passed qname and the expected namespace. Read more
Source§

fn check_start_tag_name( &self, event: &Event<'_>, ns: Option<&[u8]>, name: &[u8], ) -> bool

Try to extract the resolved tag name of either a Start or a Empty event.
Source§

fn init_start_tag_deserializer<'a, T>( &self, event: Event<'a>, ns: Option<&[u8]>, name: &[u8], allow_any: bool, ) -> DeserializerResult<'a, T>

Try to initialize a deserializer for the given event if it is a start or empty tag that matches the passed ns and name. Read more
Source§

fn get_dynamic_type_name<'a>( &self, event: &'a Event<'_>, ) -> Result<Option<Cow<'a, [u8]>>, Error>

Try to extract the type name of a dynamic type from the passed event. Read more
Source§

fn init_deserializer_from_start_event<'a, T, F>( &self, event: Event<'a>, f: F, ) -> Result<DeserializerOutput<'a, T>, Error>

Initializes a deserializer from the passed event. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,