pub(crate) struct ElementMapAccess<'de, 'd, R, E>where
R: XmlRead<'de>,
E: EntityResolver,{
start: BytesStart<'de>,
de: &'d mut Deserializer<'de, R, E>,
iter: IterState,
source: ValueSource,
fields: &'static [&'static str],
has_value_field: bool,
}
Expand description
A deserializer that extracts map-like structures from an XML. This deserializer represents a one XML tag:
<tag>...</tag>
Name of this tag is stored in a Self::start
property.
§Lifetimes
-
'de
lifetime represents a buffer, from which deserialized values can borrow their data. Depending on the underlying reader, there can be an internal buffer of deserializer (i.e. deserializer itself) or an input (in that case it is possible to approach zero-copy deserialization). -
'd
lifetime represents a parent deserializer, which could own the data buffer.
Fields§
§start: BytesStart<'de>
Tag – owner of attributes
de: &'d mut Deserializer<'de, R, E>
§iter: IterState
State of the iterator over attributes. Contains the next position in the
inner start
slice, from which next attribute should be parsed.
source: ValueSource
Current state of the accessor that determines what next call to API methods should return.
fields: &'static [&'static str]
List of field names of the struct. It is empty for maps
has_value_field: bool
If true
, then the deserialized struct has a field with a special name:
VALUE_KEY
. That field should be deserialized from the whole content
of an XML node, including tag name:
<tag>value for VALUE_KEY field<tag>
Implementations§
Source§impl<'de, 'd, R, E> ElementMapAccess<'de, 'd, R, E>where
R: XmlRead<'de>,
E: EntityResolver,
impl<'de, 'd, R, E> ElementMapAccess<'de, 'd, R, E>where
R: XmlRead<'de>,
E: EntityResolver,
Sourcepub fn new(
de: &'d mut Deserializer<'de, R, E>,
start: BytesStart<'de>,
fields: &'static [&'static str],
) -> Result<Self, DeError>
pub fn new( de: &'d mut Deserializer<'de, R, E>, start: BytesStart<'de>, fields: &'static [&'static str], ) -> Result<Self, DeError>
Create a new ElementMapAccess
Trait Implementations§
Source§impl<'de, 'd, R, E> MapAccess<'de> for ElementMapAccess<'de, 'd, R, E>where
R: XmlRead<'de>,
E: EntityResolver,
impl<'de, 'd, R, E> MapAccess<'de> for ElementMapAccess<'de, 'd, R, E>where
R: XmlRead<'de>,
E: EntityResolver,
Source§type Error = DeError
type Error = DeError
Source§fn next_key_seed<K: DeserializeSeed<'de>>(
&mut self,
seed: K,
) -> Result<Option<K::Value>, Self::Error>
fn next_key_seed<K: DeserializeSeed<'de>>( &mut self, seed: K, ) -> Result<Option<K::Value>, Self::Error>
Ok(Some(key))
for the next key in the map, or Ok(None)
if there are no more remaining entries. Read moreSource§fn next_value_seed<K: DeserializeSeed<'de>>(
&mut self,
seed: K,
) -> Result<K::Value, Self::Error>
fn next_value_seed<K: DeserializeSeed<'de>>( &mut self, seed: K, ) -> Result<K::Value, Self::Error>
Ok(value)
for the next value in the map. Read moreSource§fn next_entry_seed<K, V>(
&mut self,
kseed: K,
vseed: V,
) -> Result<Option<(<K as DeserializeSeed<'de>>::Value, <V as DeserializeSeed<'de>>::Value)>, Self::Error>where
K: DeserializeSeed<'de>,
V: DeserializeSeed<'de>,
fn next_entry_seed<K, V>(
&mut self,
kseed: K,
vseed: V,
) -> Result<Option<(<K as DeserializeSeed<'de>>::Value, <V as DeserializeSeed<'de>>::Value)>, Self::Error>where
K: DeserializeSeed<'de>,
V: DeserializeSeed<'de>,
Ok(Some((key, value)))
for the next (key-value) pair in
the map, or Ok(None)
if there are no more remaining items. Read moreSource§fn next_key<K>(&mut self) -> Result<Option<K>, Self::Error>where
K: Deserialize<'de>,
fn next_key<K>(&mut self) -> Result<Option<K>, Self::Error>where
K: Deserialize<'de>,
Ok(Some(key))
for the next key in the map, or Ok(None)
if there are no more remaining entries. Read moreSource§fn next_value<V>(&mut self) -> Result<V, Self::Error>where
V: Deserialize<'de>,
fn next_value<V>(&mut self) -> Result<V, Self::Error>where
V: Deserialize<'de>,
Ok(value)
for the next value in the map. Read moreSource§fn next_entry<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>where
K: Deserialize<'de>,
V: Deserialize<'de>,
fn next_entry<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>where
K: Deserialize<'de>,
V: Deserialize<'de>,
Ok(Some((key, value)))
for the next (key-value) pair in
the map, or Ok(None)
if there are no more remaining items. Read more