[][src]Trait serde::de::IntoDeserializer

pub trait IntoDeserializer<'de, E: Error = Error> {
    type Deserializer: Deserializer<'de, Error = E>;
    fn into_deserializer(self) -> Self::Deserializer;
}

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())
    }
}

Associated Types

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

The type of the deserializer being converted into.

Loading content...

Required methods

fn into_deserializer(self) -> Self::Deserializer

Convert this value into a deserializer.

Loading content...

Implementations on Foreign Types

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

type Deserializer = UnitDeserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for bool where
    E: Error
[src]

type Deserializer = BoolDeserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for i8 where
    E: Error
[src]

type Deserializer = I8Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for i16 where
    E: Error
[src]

type Deserializer = I16Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for i32 where
    E: Error
[src]

type Deserializer = I32Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for i64 where
    E: Error
[src]

type Deserializer = I64Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for isize where
    E: Error
[src]

type Deserializer = IsizeDeserializer<E>

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

type Deserializer = U8Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for u16 where
    E: Error
[src]

type Deserializer = U16Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for u64 where
    E: Error
[src]

type Deserializer = U64Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for usize where
    E: Error
[src]

type Deserializer = UsizeDeserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for f32 where
    E: Error
[src]

type Deserializer = F32Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for f64 where
    E: Error
[src]

type Deserializer = F64Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for char where
    E: Error
[src]

type Deserializer = CharDeserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for i128 where
    E: Error
[src]

type Deserializer = I128Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for u128 where
    E: Error
[src]

type Deserializer = U128Deserializer<E>

impl<'de, E> IntoDeserializer<'de, E> for u32 where
    E: Error
[src]

type Deserializer = U32Deserializer<E>

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

type Deserializer = StrDeserializer<'a, E>

impl<'de, E> IntoDeserializer<'de, E> for String where
    E: Error
[src]

type Deserializer = StringDeserializer<E>

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

type Deserializer = CowStrDeserializer<'a, E>

impl<'de, T, E> IntoDeserializer<'de, E> for Vec<T> where
    T: IntoDeserializer<'de, E>,
    E: Error
[src]

type Deserializer = SeqDeserializer<Self::IntoIter, E>

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

type Deserializer = SeqDeserializer<Self::IntoIter, E>

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

type Deserializer = SeqDeserializer<Self::IntoIter, E>

impl<'de, K, V, E> IntoDeserializer<'de, E> for BTreeMap<K, V> where
    K: IntoDeserializer<'de, E> + Eq + Ord,
    V: IntoDeserializer<'de, E>,
    E: Error
[src]

type Deserializer = MapDeserializer<'de, Self::IntoIter, E>

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
[src]

type Deserializer = MapDeserializer<'de, Self::IntoIter, E>

Loading content...

Implementors

Loading content...