pub trait XmlDeserialize: Sized {
// Required method
fn deserialize<B: BufRead>(
tag: &[u8],
reader: &mut Reader<B>,
attrs: Attributes<'_>,
is_empty: bool,
) -> Self;
// Provided methods
fn de_root() -> Option<&'static [u8]> { ... }
fn __get_children_tags() -> Vec<&'static [u8]> { ... }
fn __deserialize_from_unparsed_array(
_array: Vec<(&'static [u8], Unparsed)>,
) -> Self { ... }
fn __is_enum() -> bool { ... }
fn __deserialize_from_text(_: &str) -> Option<Self>
where Self: Sized { ... }
}Required Methods§
fn deserialize<B: BufRead>( tag: &[u8], reader: &mut Reader<B>, attrs: Attributes<'_>, is_empty: bool, ) -> Self
Provided Methods§
fn de_root() -> Option<&'static [u8]>
A helper function used when ty = untag. It could help
us to find out the children tags when deserializing
Sourcefn __deserialize_from_unparsed_array(
_array: Vec<(&'static [u8], Unparsed)>,
) -> Self
fn __deserialize_from_unparsed_array( _array: Vec<(&'static [u8], Unparsed)>, ) -> Self
A helper function used when handling the untag types.
For a outside struct, it doesn’t
know how to deal with an untag type. The current solution is to treat them as Unparsed
types first, and then pass them into this function to deserialize. Since the type is untagged,
it doesn’t require the attributes.
Sourcefn __is_enum() -> bool
fn __is_enum() -> bool
A helper function for handling the untagged types.
For efficiency, deserializing enums has no need to handle the untagged types by __deserialize_from_unparsed_array method.
But we have no idea of whether this field is not enum or not, we make a helper function to discern it
in the runtime.
fn __deserialize_from_text(_: &str) -> Option<Self>where
Self: Sized,
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.