pub trait MapValueAccess<'de>: Sized {
type Error: Error;
type Key: MapKeyAccess<'de, Error = Self::Error, Value = Self>;
// Required method
fn next_value_seed<S>(
self,
seed: S,
) -> Result<(S::Value, Option<Self::Key>), Self::Error>
where S: DeserializeSeed<'de>;
// Provided methods
fn next_value<T>(self) -> Result<(T, Option<Self::Key>), Self::Error>
where T: Deserialize<'de> { ... }
fn size_hint(&self) -> Option<usize> { ... }
}Expand description
Move-oriented version of serde::de::MapAccess for getting values associated
with keys.
A MapValueAccess object is returned alongside a key from a call to
next_key, if the map wasn’t empty. It can be used
to retrieve the value associated with that key, and additionally returns a
new MapKeyAccess that can be used to retrieve the next entry from the map.
This trait otherwise is identical to its serde counterpart and serves the same
purpose; see those docs for details (though note that accessing keys and entries
is handled separately through the MapKeyAccess trait.)
Required Associated Types§
Sourcetype Key: MapKeyAccess<'de, Error = Self::Error, Value = Self>
type Key: MapKeyAccess<'de, Error = Self::Error, Value = Self>
The value accessor associated with this key accessor. A call to
next_value will also return a Key object, which can
be used to retrieve the next key from the map.
Required Methods§
Sourcefn next_value_seed<S>(
self,
seed: S,
) -> Result<(S::Value, Option<Self::Key>), Self::Error>where
S: DeserializeSeed<'de>,
fn next_value_seed<S>(
self,
seed: S,
) -> Result<(S::Value, Option<Self::Key>), Self::Error>where
S: DeserializeSeed<'de>,
This returns the next value from the map, associated with the
previously accessed key. It additionally returns an optional key_access
object which can be used to retrieve additional keys from the map, if any.
The seed allows for passing data into a Deserialize implementation
at runtime; typically it makes more sense to call next_value.
Provided Methods§
Sourcefn next_value<T>(self) -> Result<(T, Option<Self::Key>), Self::Error>where
T: Deserialize<'de>,
fn next_value<T>(self) -> Result<(T, Option<Self::Key>), Self::Error>where
T: Deserialize<'de>,
This returns the next value from the map, associated with the
previously accessed key. It additionally returns an optional key_access
object which can be used to retrieve additional keys from the map, if any.
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.