SubordinateValue

Struct SubordinateValue 

Source
pub struct SubordinateValue<V, K> {
    pub value: V,
    pub parent: K,
}
Expand description

Utility type implementing MapValueAccess for the common case where a value-access type consists only of a deserializable value, along with the original MapKeyAccess type that produced it, which will be returned after the value is consumed.

See the crate docs for an example.

Fields§

§value: V

The value that will be deserialized in next_value_seed.

§parent: K

The MapKeyAccess object that will be returned along with value, after it was deserialized. Usually this will be the same object that created this SubordinateValue in the first place.

Trait Implementations§

Source§

impl<V: Clone, K: Clone> Clone for SubordinateValue<V, K>

Source§

fn clone(&self) -> SubordinateValue<V, K>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug, K: Debug> Debug for SubordinateValue<V, K>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, K, V> MapValueAccess<'de> for SubordinateValue<V, K>
where V: Deserializer<'de>, K: MapKeyAccess<'de, Value = Self, Error = V::Error>,

Source§

type Error = <V as Deserializer<'de>>::Error

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

type Key = K

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.
Source§

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. Read more
Source§

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

Returns the number of entries remaining in the map, if known. Note that, because this returns the number of entries, the value associated with this particular MapValueAccess should not be included.
Source§

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.

Auto Trait Implementations§

§

impl<V, K> Freeze for SubordinateValue<V, K>
where V: Freeze, K: Freeze,

§

impl<V, K> RefUnwindSafe for SubordinateValue<V, K>

§

impl<V, K> Send for SubordinateValue<V, K>
where V: Send, K: Send,

§

impl<V, K> Sync for SubordinateValue<V, K>
where V: Sync, K: Sync,

§

impl<V, K> Unpin for SubordinateValue<V, K>
where V: Unpin, K: Unpin,

§

impl<V, K> UnwindSafe for SubordinateValue<V, K>
where V: UnwindSafe, K: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.