Trait serde::de::IntoDeserializer
source · pub trait IntoDeserializer<'de, E: Error = Error> {
type Deserializer: Deserializer<'de, Error = E>;
// Required method
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 serde::de::{value, Deserialize, IntoDeserializer};
use serde_derive::Deserialize;
use std::str::FromStr;
#[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§
source§impl<'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>
source§impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a [u8]where
E: Error,
impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a [u8]where
E: Error,
type Deserializer = BytesDeserializer<'a, E>
fn into_deserializer(self) -> BytesDeserializer<'a, E>
source§impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str>where
E: Error,
Available on crate features std
or alloc
only.
impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str>where
E: Error,
Available on crate features
std
or alloc
only.type Deserializer = CowStrDeserializer<'a, E>
fn into_deserializer(self) -> CowStrDeserializer<'a, E>
source§impl<'de, E> IntoDeserializer<'de, E> for boolwhere
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for boolwhere
E: Error,
type Deserializer = BoolDeserializer<E>
fn into_deserializer(self) -> BoolDeserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for charwhere
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for charwhere
E: Error,
type Deserializer = CharDeserializer<E>
fn into_deserializer(self) -> CharDeserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for f32where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for f32where
E: Error,
type Deserializer = F32Deserializer<E>
fn into_deserializer(self) -> F32Deserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for f64where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for f64where
E: Error,
type Deserializer = F64Deserializer<E>
fn into_deserializer(self) -> F64Deserializer<E>
source§impl<'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>
source§impl<'de, E> IntoDeserializer<'de, E> for i16where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for i16where
E: Error,
type Deserializer = I16Deserializer<E>
fn into_deserializer(self) -> I16Deserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for i32where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for i32where
E: Error,
type Deserializer = I32Deserializer<E>
fn into_deserializer(self) -> I32Deserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for i64where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for i64where
E: Error,
type Deserializer = I64Deserializer<E>
fn into_deserializer(self) -> I64Deserializer<E>
source§impl<'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>
source§impl<'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>
source§impl<'de, E> IntoDeserializer<'de, E> for !where
E: Error,
Available on crate feature unstable
only.
impl<'de, E> IntoDeserializer<'de, E> for !where
E: Error,
Available on crate feature
unstable
only.type Deserializer = NeverDeserializer<E>
fn into_deserializer(self) -> Self::Deserializer
source§impl<'de, E> IntoDeserializer<'de, E> for u8where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for u8where
E: Error,
type Deserializer = U8Deserializer<E>
fn into_deserializer(self) -> U8Deserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for u16where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for u16where
E: Error,
type Deserializer = U16Deserializer<E>
fn into_deserializer(self) -> U16Deserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for u32where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for u32where
E: Error,
type Deserializer = U32Deserializer<E>
fn into_deserializer(self) -> U32Deserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for u64where
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for u64where
E: Error,
type Deserializer = U64Deserializer<E>
fn into_deserializer(self) -> U64Deserializer<E>
source§impl<'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>
source§impl<'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>
source§impl<'de, E> IntoDeserializer<'de, E> for usizewhere
E: Error,
impl<'de, E> IntoDeserializer<'de, E> for usizewhere
E: Error,
type Deserializer = UsizeDeserializer<E>
fn into_deserializer(self) -> UsizeDeserializer<E>
source§impl<'de, E> IntoDeserializer<'de, E> for Stringwhere
E: Error,
Available on crate features std
or alloc
only.
impl<'de, E> IntoDeserializer<'de, E> for Stringwhere
E: Error,
Available on crate features
std
or alloc
only.type Deserializer = StringDeserializer<E>
fn into_deserializer(self) -> StringDeserializer<E>
source§impl<'de, K, V, E> IntoDeserializer<'de, E> for BTreeMap<K, V>
Available on crate features std
or alloc
only.
impl<'de, K, V, E> IntoDeserializer<'de, E> for BTreeMap<K, V>
Available on crate features
std
or alloc
only.type Deserializer = MapDeserializer<'de, <BTreeMap<K, V> as IntoIterator>::IntoIter, E>
fn into_deserializer(self) -> Self::Deserializer
source§impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap<K, V, S>where
K: IntoDeserializer<'de, E> + Eq + Hash,
V: IntoDeserializer<'de, E>,
S: BuildHasher,
E: Error,
Available on crate feature std
only.
impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap<K, V, S>where
K: IntoDeserializer<'de, E> + Eq + Hash,
V: IntoDeserializer<'de, E>,
S: BuildHasher,
E: Error,
Available on crate feature
std
only.type Deserializer = MapDeserializer<'de, <HashMap<K, V, S> as IntoIterator>::IntoIter, E>
fn into_deserializer(self) -> Self::Deserializer
source§impl<'de, T, E> IntoDeserializer<'de, E> for BTreeSet<T>
Available on crate features std
or alloc
only.
impl<'de, T, E> IntoDeserializer<'de, E> for BTreeSet<T>
Available on crate features
std
or alloc
only.type Deserializer = SeqDeserializer<<BTreeSet<T> as IntoIterator>::IntoIter, E>
fn into_deserializer(self) -> Self::Deserializer
source§impl<'de, T, E> IntoDeserializer<'de, E> for Vec<T>where
T: IntoDeserializer<'de, E>,
E: Error,
Available on crate features std
or alloc
only.
impl<'de, T, E> IntoDeserializer<'de, E> for Vec<T>where
T: IntoDeserializer<'de, E>,
E: Error,
Available on crate features
std
or alloc
only.type Deserializer = SeqDeserializer<<Vec<T> as IntoIterator>::IntoIter, E>
fn into_deserializer(self) -> Self::Deserializer
source§impl<'de, T, S, E> IntoDeserializer<'de, E> for HashSet<T, S>
Available on crate feature std
only.
impl<'de, T, S, E> IntoDeserializer<'de, E> for HashSet<T, S>
Available on crate feature
std
only.