pub struct Deserializer<'a> { /* private fields */ }Expand description
Deserializes XML documents.
Implementations§
Source§impl<'a> Deserializer<'a>
impl<'a> Deserializer<'a>
Sourcepub fn from_str(input: &'a str) -> Deserializer<'a>
pub fn from_str(input: &'a str) -> Deserializer<'a>
Creates a deserializer for a string.
Sourcepub fn from_str_with_config(
input: &'a str,
config: DeserializerConfig,
) -> Deserializer<'a>
pub fn from_str_with_config( input: &'a str, config: DeserializerConfig, ) -> Deserializer<'a>
Creates a deserializer for a string with the given configuration.
Sourcepub fn from_slice(input: &'a [u8]) -> Deserializer<'a>
pub fn from_slice(input: &'a [u8]) -> Deserializer<'a>
Creates a deserializer for UTF-8 encoded bytes.
Sourcepub fn from_slice_with_config(
input: &'a [u8],
config: DeserializerConfig,
) -> Deserializer<'a>
pub fn from_slice_with_config( input: &'a [u8], config: DeserializerConfig, ) -> Deserializer<'a>
Creates a deserializer for UTF-8 encoded bytes with the given configuration.
Sourcepub fn config(&self) -> &DeserializerConfig
pub fn config(&self) -> &DeserializerConfig
Returns the configuration.
Sourcepub fn deserialize<T: Deserialize<'a>>(&mut self) -> Result<T, Error>
pub fn deserialize<T: Deserialize<'a>>(&mut self) -> Result<T, Error>
Deserializes the document.
Sourcepub fn deserialize_with<T, F>(&mut self, setup: F) -> Result<T, Error>
pub fn deserialize_with<T, F>(&mut self, setup: F) -> Result<T, Error>
Deserializes the document with a configured driver.
The callback is invoked with the driver before the value is
deserialized, for instance to add Layers.
Sourcepub fn drive(
&mut self,
driver: &mut DeserializeDriver<'_, 'a>,
) -> Result<(), Error>
pub fn drive( &mut self, driver: &mut DeserializeDriver<'_, 'a>, ) -> Result<(), Error>
Parses the document and feeds the events into the driver.
Events are emitted while the document is parsed. Text is passed on borrowed from the input unless it has references or line breaks that are normalized.
The context of the configuration is given to the driver (values that
the context of the driver has take precedence, see
DeserializeDriver::set_default_context).