pub trait IntoDeserializer<'de, E = Error>where
E: Error,{
type Deserializer: Deserializer<'de, Error = E>;
fn into_deserializer(self) -> Self::Deserializer;
}Expand description
Converts an existing value into a Deserializer from which other values can
be deserialized.
Lifetime
The 'de lifetime of this trait is the lifetime of data that may be
borrowed from the resulting Deserializer. See the page Understanding
deserializer lifetimes for a more detailed explanation of these lifetimes.
Example
ⓘ
use std::str::FromStr;
use serde::Deserialize;
use serde::de::{value, IntoDeserializer};
#[derive(Deserialize)]
enum Setting {
On,
Off,
}
impl FromStr for Setting {
type Err = value::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Self::deserialize(s.into_deserializer())
}
}Required Associated Types
sourcetype Deserializer: Deserializer<'de, Error = E>
type Deserializer: Deserializer<'de, Error = E>
The type of the deserializer being converted into.
Required Methods
sourcefn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
Implementations on Foreign Types
sourceimpl<'de, T, E> IntoDeserializer<'de, E> for BTreeSet<T, Global>where
T: IntoDeserializer<'de, E> + Eq + Ord,
E: Error,
impl<'de, T, E> IntoDeserializer<'de, E> for BTreeSet<T, Global>where
T: IntoDeserializer<'de, E> + Eq + Ord,
E: Error,
type Deserializer = SeqDeserializer<<BTreeSet<T, Global> as IntoIterator>::IntoIter, E>
fn into_deserializer(
self
) -> <BTreeSet<T, Global> as IntoDeserializer<'de, E>>::Deserializer
sourceimpl<'de, K, V, E> IntoDeserializer<'de, E> for BTreeMap<K, V, Global>where
K: IntoDeserializer<'de, E> + Eq + Ord,
V: IntoDeserializer<'de, E>,
E: Error,
impl<'de, K, V, E> IntoDeserializer<'de, E> for BTreeMap<K, V, Global>where
K: IntoDeserializer<'de, E> + Eq + Ord,
V: IntoDeserializer<'de, E>,
E: Error,
type Deserializer = MapDeserializer<'de, <BTreeMap<K, V, Global> as IntoIterator>::IntoIter, E>
fn into_deserializer(
self
) -> <BTreeMap<K, V, Global> as IntoDeserializer<'de, E>>::Deserializer
sourceimpl<'de, 'a, E> IntoDeserializer<'de, E> for &'a strwhere
E: Error,
impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a strwhere
E: Error,
type Deserializer = StrDeserializer<'a, E>
fn into_deserializer(self) -> StrDeserializer<'a, E>
sourceimpl<'de, E> IntoDeserializer<'de, E> for u128where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for u128where
E: Error,
type Deserializer = U128Deserializer<E>
fn into_deserializer(self) -> U128Deserializer<E>
sourceimpl<'de, E> IntoDeserializer<'de, E> for Stringwhere
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for Stringwhere
E: Error,
type Deserializer = StringDeserializer<E>
fn into_deserializer(self) -> StringDeserializer<E>
sourceimpl<'de, E> IntoDeserializer<'de, E> for i128where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for i128where
E: Error,
type Deserializer = I128Deserializer<E>
fn into_deserializer(self) -> I128Deserializer<E>
sourceimpl<'de, E> IntoDeserializer<'de, E> for isizewhere
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for isizewhere
E: Error,
type Deserializer = IsizeDeserializer<E>
fn into_deserializer(self) -> IsizeDeserializer<E>
sourceimpl<'de, E> IntoDeserializer<'de, E> for i8where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for i8where
E: Error,
type Deserializer = I8Deserializer<E>
fn into_deserializer(self) -> I8Deserializer<E>
sourceimpl<'de, E> IntoDeserializer<'de, E> for ()where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for ()where
E: Error,
type Deserializer = UnitDeserializer<E>
fn into_deserializer(self) -> UnitDeserializer<E>
sourceimpl<'de, T, E> IntoDeserializer<'de, E> for Vec<T, Global>where
T: IntoDeserializer<'de, E>,
E: Error,
impl<'de, T, E> IntoDeserializer<'de, E> for Vec<T, Global>where
T: IntoDeserializer<'de, E>,
E: Error,
type Deserializer = SeqDeserializer<<Vec<T, Global> as IntoIterator>::IntoIter, E>
fn into_deserializer(
self
) -> <Vec<T, Global> as IntoDeserializer<'de, E>>::DeserializerⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,