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: XmlErrorLevelThe 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_intThe module that the error came from. See libxml’s xmlErrorDomain enum.
code: c_intThe variety of error. See libxml’s xmlParserErrors enum.
Implementations§
Source§impl StructuredError
impl StructuredError
Sourcepub unsafe fn from_raw(error_ptr: *const xmlError) -> Self
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.
Sourcepub fn message(&self) -> &str
👎Deprecated since 0.3.3: Please use the message field directly instead.
pub fn message(&self) -> &str
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.