pub trait XmlReader: Sized {
// Required methods
fn resolve<'n>(
&self,
name: QName<'n>,
attribute: bool,
) -> (ResolveResult<'_>, LocalName<'n>);
fn namespaces(&self) -> NamespacesShared<'static>;
fn current_position(&self) -> u64;
fn error_position(&self) -> u64;
// Provided methods
fn extend_error(&self, error: Error) -> Error { ... }
fn map_error<E>(&self, error: E) -> Error
where Error: From<E> { ... }
fn map_result<T, E>(&self, result: Result<T, E>) -> Result<T, Error>
where Error: From<E> { ... }
fn err<E>(&self, error: E) -> Result<(), Error>
where Error: From<E> { ... }
fn with_error_info(self) -> ErrorReader<Self> { ... }
}
Expand description
Trait that defines the basics for an XML reader.
Required Methods§
Sourcefn resolve<'n>(
&self,
name: QName<'n>,
attribute: bool,
) -> (ResolveResult<'_>, LocalName<'n>)
fn resolve<'n>( &self, name: QName<'n>, attribute: bool, ) -> (ResolveResult<'_>, LocalName<'n>)
Resolves a qname in the current context of the XML file.
Sourcefn namespaces(&self) -> NamespacesShared<'static>
fn namespaces(&self) -> NamespacesShared<'static>
Returns a map that contains all namespaces in the current context.
Sourcefn current_position(&self) -> u64
fn current_position(&self) -> u64
Returns the current position (byte offset) in the current XML file.
Sourcefn error_position(&self) -> u64
fn error_position(&self) -> u64
Returns the position (byte offset) of the last detected error.
Provided Methods§
Sourcefn extend_error(&self, error: Error) -> Error
fn extend_error(&self, error: Error) -> Error
Add the error position to the passed error and return it.
Sourcefn map_error<E>(&self, error: E) -> Error
fn map_error<E>(&self, error: E) -> Error
Converts the passed error
to an Error
, adds the error information
using extend_error
and returns it.
Sourcefn map_result<T, E>(&self, result: Result<T, E>) -> Result<T, Error>
fn map_result<T, E>(&self, result: Result<T, E>) -> Result<T, Error>
Same as map_error
, but for the passed result
.
Sourcefn err<E>(&self, error: E) -> Result<(), Error>
fn err<E>(&self, error: E) -> Result<(), Error>
Create a result from the passed error
using map_error
and returns it.
Sourcefn with_error_info(self) -> ErrorReader<Self>
fn with_error_info(self) -> ErrorReader<Self>
Wraps the current reader in a new ErrorReader
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.