pub trait IntoDeserializer<'de, E = Error>where
    E: 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§

source

type Deserializer: Deserializer<'de, Error = E>

The type of the deserializer being converted into.

Required Methods§

source

fn into_deserializer(self) -> Self::Deserializer

Convert this value into a deserializer.

Implementations on Foreign Types§

source§

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,

source§

impl<'de, E> IntoDeserializer<'de, E> for i64where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for u64where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for u32where E: Error,

source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a [u8]where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for isizewhere E: Error,

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,

source§

impl<'de, T, E> IntoDeserializer<'de, E> for Vec<T, Global>where T: IntoDeserializer<'de, E>, E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for i32where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for u128where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for f32where E: Error,

source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a strwhere E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for i8where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for u8where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for boolwhere E: Error,

source§

impl<'de, T, S, E> IntoDeserializer<'de, E> for HashSet<T, S>where T: IntoDeserializer<'de, E> + Eq + Hash, S: BuildHasher, E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for usizewhere E: Error,

source§

impl<'de, T, E> IntoDeserializer<'de, E> for BTreeSet<T, Global>where T: IntoDeserializer<'de, E> + Eq + Ord, E: Error,

source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for Stringwhere E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for charwhere E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for i16where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for u16where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for f64where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for ()where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for i128where E: Error,

Implementors§

source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for BytesDeserializer<'a, E>where E: Error,

source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for CowStrDeserializer<'a, E>where E: Error,

source§

impl<'de, 'a, E> IntoDeserializer<'de, E> for StrDeserializer<'a, E>where E: Error,

source§

impl<'de, A> IntoDeserializer<'de, <A as EnumAccess<'de>>::Error> for EnumAccessDeserializer<A>where A: EnumAccess<'de>,

source§

impl<'de, A> IntoDeserializer<'de, <A as MapAccess<'de>>::Error> for MapAccessDeserializer<A>where A: MapAccess<'de>,

source§

impl<'de, A> IntoDeserializer<'de, <A as SeqAccess<'de>>::Error> for SeqAccessDeserializer<A>where A: SeqAccess<'de>,

source§

impl<'de, E> IntoDeserializer<'de, E> for BoolDeserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for BorrowedBytesDeserializer<'de, E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for BorrowedStrDeserializer<'de, E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for CharDeserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for F32Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for F64Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for I8Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for I16Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for I32Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for I64Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for I128Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for IsizeDeserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for StringDeserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for U8Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for U16Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for U32Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for U64Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for U128Deserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for UnitDeserializer<E>where E: Error,

source§

impl<'de, E> IntoDeserializer<'de, E> for UsizeDeserializer<E>where E: Error,

source§

impl<'de, I, E> IntoDeserializer<'de, E> for MapDeserializer<'de, I, E>where I: Iterator, <I as Iterator>::Item: Pair, <<I as Iterator>::Item as Pair>::First: IntoDeserializer<'de, E>, <<I as Iterator>::Item as Pair>::Second: IntoDeserializer<'de, E>, E: Error,

source§

impl<'de, I, T, E> IntoDeserializer<'de, E> for SeqDeserializer<I, E>where I: Iterator<Item = T>, T: IntoDeserializer<'de, E>, E: Error,