pub trait MapAccess<'de> {
type Error: Error;
Show 13 methods
// Required methods
fn class_ptr(&mut self) -> Option<Pointer>;
fn next_key_seed<K>(
&mut self,
seed: K,
) -> Result<Option<K::Value>, Self::Error>
where K: DeserializeSeed<'de>;
fn next_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>
where V: DeserializeSeed<'de>;
fn skip_value_seed(&mut self) -> Result<(), Self::Error>;
fn parent_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>
where V: DeserializeSeed<'de>;
// Provided methods
fn pad(&mut self, x86_pad: usize, x64_pad: usize) -> Result<(), Self::Error> { ... }
fn next_entry_seed<K, V>(
&mut self,
kseed: K,
vseed: V,
) -> Result<Option<(K::Value, V::Value)>, Self::Error>
where K: DeserializeSeed<'de>,
V: DeserializeSeed<'de> { ... }
fn next_key<K>(&mut self) -> Result<Option<K>, Self::Error>
where K: Deserialize<'de> { ... }
fn next_value<V>(&mut self) -> Result<V, Self::Error>
where V: Deserialize<'de> { ... }
fn skip_value(&mut self) -> Result<(), Self::Error> { ... }
fn parent_value<V>(&mut self) -> Result<V, Self::Error>
where V: Deserialize<'de> { ... }
fn next_entry<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>
where K: Deserialize<'de>,
V: Deserialize<'de> { ... }
fn size_hint(&self) -> Option<usize> { ... }
}Expand description
Provides a Visitor access to each entry of a map in the input.
This is a trait that a Deserializer passes to a Visitor implementation.
§Lifetime
The 'de lifetime of this trait is the lifetime of data that may be
borrowed by deserialized map entries. See the page Understanding
deserializer lifetimes for a more detailed explanation of these lifetimes.
§Example implementation
The example data format presented on the website demonstrates an
implementation of MapAccess for a basic JSON data format.
Required Associated Types§
Required Methods§
Sourcefn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>, Self::Error>where
K: DeserializeSeed<'de>,
fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>, Self::Error>where
K: DeserializeSeed<'de>,
This returns Ok(Some(key)) for the next key in the map, or Ok(None)
if there are no more remaining entries.
Deserialize implementations should typically use
MapAccess::next_key or MapAccess::next_entry instead.
Sourcefn next_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>where
V: DeserializeSeed<'de>,
fn next_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>where
V: DeserializeSeed<'de>,
This returns a Ok(value) for the next value in the map.
Deserialize implementations should typically use
MapAccess::next_value instead.
Sourcefn skip_value_seed(&mut self) -> Result<(), Self::Error>
fn skip_value_seed(&mut self) -> Result<(), Self::Error>
Deserialize implementations should typically use
MapAccess::skip_value instead.
§Primary use.
Clean up after the XML tag when unwanted items come in.
Sourcefn parent_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>where
V: DeserializeSeed<'de>,
fn parent_value_seed<V>(&mut self, seed: V) -> Result<V::Value, Self::Error>where
V: DeserializeSeed<'de>,
Deserialize C++ inherited parent fields(for bytes method)
This returns a Ok(value) for the next value in the map.
Deserialize implementations should typically use
MapAccess::next_value instead.
Provided Methods§
Sourcefn pad(&mut self, x86_pad: usize, x64_pad: usize) -> Result<(), Self::Error>
fn pad(&mut self, x86_pad: usize, x64_pad: usize) -> Result<(), Self::Error>
- Skip reading the current position of binary data by pad minutes.
- The XML deserializer does nothing.
The default implementation does nothing.
Sourcefn next_entry_seed<K, V>(
&mut self,
kseed: K,
vseed: V,
) -> Result<Option<(K::Value, V::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::Value, V::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.
MapAccess implementations should override the default behavior if a
more efficient implementation is possible.
Deserialize implementations should typically use
MapAccess::next_entry instead.
Sourcefn 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>,
This returns Ok(Some(key)) for the next key in the map, or Ok(None)
if there are no more remaining entries.
This method exists as a convenience for Deserialize implementations.
MapAccess implementations should not override the default behavior.
Sourcefn 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>,
This returns a Ok(value) for the next value in the map.
This method exists as a convenience for Deserialize implementations.
MapAccess implementations should not override the default behavior.
Sourcefn skip_value(&mut self) -> Result<(), Self::Error>
fn skip_value(&mut self) -> Result<(), Self::Error>
This returns a Ok(()) for the skip value in the map.
§Primary use.
Clean up after the XML tag when unwanted items come in.
Sourcefn parent_value<V>(&mut self) -> Result<V, Self::Error>where
V: Deserialize<'de>,
fn parent_value<V>(&mut self) -> Result<V, Self::Error>where
V: Deserialize<'de>,
Deserialize C++ inherited parent fields(for bytes method)
This returns a Ok(value) for the next value in the map.
This method exists as a convenience for Deserialize implementations.
MapAccess implementations should not override the default behavior.
Sourcefn 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>,
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.
This method exists as a convenience for Deserialize implementations.
MapAccess implementations should not override the default behavior.
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.