pub trait DeserializeBytes: Sized {
// Required method
fn deserialize_bytes<R: XmlReader>(
reader: &R,
bytes: &[u8],
) -> Result<Self, Error>;
// Provided method
fn deserialize_str<R: XmlReader>(reader: &R, s: &str) -> Result<Self, Error> { ... }
}
Expand description
Trait that could be implemented by types to support deserialization from
XML byte streams using the quick_xml
crate.
This is usually implemented for simple types like numbers, strings or enums.
Required Methods§
Provided Methods§
Sourcefn deserialize_str<R: XmlReader>(reader: &R, s: &str) -> Result<Self, Error>
fn deserialize_str<R: XmlReader>(reader: &R, s: &str) -> Result<Self, Error>
Optimized version of deserialize_bytes
that
takes a string instead of a bytes slice.
This is useful if previous checks on the string already did the UTF-8 conversion.
§Errors
Returns a suitable Error
if the deserialization was not successful.
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.