use super::bindings;
use std::ffi::CStr;
#[derive(Debug)]
pub struct StructuredError(*mut bindings::_xmlError);
impl StructuredError {
pub fn from_raw(error: *mut bindings::_xmlError) -> Self {
Self(error)
}
pub fn message(&self) -> &str {
let msg = unsafe { CStr::from_ptr((*self.0).message) };
msg.to_str().unwrap()
}
pub fn as_ptr(&self) -> *const bindings::_xmlError {
self.0 }
}
impl Drop for StructuredError {
fn drop(&mut self) {
unsafe { bindings::xmlResetError(self.0) }
}
}