Struct ElementMapAccess

Source
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,

Source

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,

Source§

type Error = DeError

The error type that can be returned if some error occurs during deserialization.
Source§

fn next_key_seed<K: DeserializeSeed<'de>>( &mut self, seed: K, ) -> Result<Option<K::Value>, Self::Error>

This returns Ok(Some(key)) for the next key in the map, or Ok(None) if there are no more remaining entries. Read more
Source§

fn next_value_seed<K: DeserializeSeed<'de>>( &mut self, seed: K, ) -> Result<K::Value, Self::Error>

This returns a Ok(value) for the next value in the map. Read more
Source§

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>,

This returns 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
Source§

fn next_key<K>(&mut self) -> Result<Option<K>, Self::Error>
where K: Deserialize<'de>,

This returns Ok(Some(key)) for the next key in the map, or Ok(None) if there are no more remaining entries. Read more
Source§

fn next_value<V>(&mut self) -> Result<V, Self::Error>
where V: Deserialize<'de>,

This returns a Ok(value) for the next value in the map. Read more
Source§

fn next_entry<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>
where K: Deserialize<'de>, V: Deserialize<'de>,

This returns 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
Source§

fn size_hint(&self) -> Option<usize>

Returns the number of entries remaining in the map, if known.

Auto Trait Implementations§

§

impl<'de, 'd, R, E> Freeze for ElementMapAccess<'de, 'd, R, E>

§

impl<'de, 'd, R, E> !RefUnwindSafe for ElementMapAccess<'de, 'd, R, E>

§

impl<'de, 'd, R, E> Send for ElementMapAccess<'de, 'd, R, E>
where R: Send, E: Send,

§

impl<'de, 'd, R, E> Sync for ElementMapAccess<'de, 'd, R, E>
where R: Sync, E: Sync,

§

impl<'de, 'd, R, E> Unpin for ElementMapAccess<'de, 'd, R, E>

§

impl<'de, 'd, R, E> !UnwindSafe for ElementMapAccess<'de, 'd, R, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.