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

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.

#[macro_use]
extern crate serde_derive;

extern crate serde;

use std::str::FromStr;
use serde::de::{value, Deserialize, 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

The type of the deserializer being converted into.

Required Methods

Convert this value into a deserializer.

Implementors