Struct StructuredError

Source
pub struct StructuredError {
    pub message: Option<String>,
    pub level: XmlErrorLevel,
    pub filename: Option<String>,
    pub line: Option<c_int>,
    pub col: Option<c_int>,
    pub domain: c_int,
    pub code: c_int,
}
Expand description

Wrapper around xmlErrorPtr. Some fields have been omitted for simplicity/safety

Fields§

§message: Option<String>

Human-friendly error message, lossily converted into UTF-8 from the underlying C string. May be None if an error message is not provided by libxml2.

§level: XmlErrorLevel

The error’s level

§filename: Option<String>

The filename, lossily converted into UTF-8 from the underlying C string. May be None if a filename is not provided by libxml2, such as when validating an XML document stored entirely in memory.

§line: Option<c_int>

The linenumber, or None if not applicable.

§col: Option<c_int>

The column where the error is present, or None if not applicable.

§domain: c_int

The module that the error came from. See libxml’s xmlErrorDomain enum.

§code: c_int

The variety of error. See libxml’s xmlParserErrors enum.

Implementations§

Source§

impl StructuredError

Source

pub unsafe fn from_raw(error_ptr: *const xmlError) -> Self

Copies the error information stored at error_ptr into a new StructuredError

§Safety

This function must be given a pointer to a valid xmlError struct. Typically, you will acquire such a pointer by implementing one of a number of callbacks defined in libXml which are provided an xmlError as an argument.

This function copies data from the memory error_ptr but does not deallocate the error. Depending on the context in which this function is used, you may need to take additional steps to avoid a memory leak.

Source

pub fn message(&self) -> &str

👎Deprecated since 0.3.3: Please use the message field directly instead.

Human-readable informative error message.

This function is a hold-over from the original bindings to libxml’s error reporting mechanism. Instead of calling this method, you can access the StructuredError message field directly.

Trait Implementations§

Source§

impl Debug for StructuredError

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.