Trait serde::de::Deserializer [] [src]

pub trait Deserializer {
    type Error: Error;
    fn visit<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor;

    fn visit_option<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_seq<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_map<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_named_unit<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_named_seq<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_named_map<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
    fn visit_enum<V>(&mut self, _enum: &str, _visitor: V) -> Result<V::Value, Self::Error> where V: EnumVisitor { ... }
    fn visit_bytes<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor { ... }
}

Deserializer is an abstract trait that can deserialize values into a Visitor.

Associated Types

type Error: Error

Required Methods

fn visit<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit method walks a visitor through a value as it is being deserialized.

Provided Methods

fn visit_option<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_option method allows a Deserialize type to inform the Deserializer that it's expecting an optional value. This allows deserializers that encode an optional value as a nullable value to convert the null value into a None, and a regular value as Some(value).

fn visit_seq<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_seq method allows a Deserialize type to inform the Deserializer that it's expecting a sequence of values. This allows deserializers to parse sequences that aren't tagged as sequences.

fn visit_map<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_map method allows a Deserialize type to inform the Deserializer that it's expecting a map of values. This allows deserializers to parse sequences that aren't tagged as maps.

fn visit_named_unit<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_named_unit method allows a Deserialize type to inform the Deserializer that it's expecting a named unit. This allows deserializers to a named unit that aren't tagged as a named unit.

fn visit_named_seq<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_named_seq method allows a Deserialize type to inform the Deserializer that it's expecting a named sequence of values. This allows deserializers to parse sequences that aren't tagged as sequences.

fn visit_named_map<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_named_map method allows a Deserialize type to inform the Deserializer that it's expecting a map of values. This allows deserializers to parse sequences that aren't tagged as maps.

fn visit_enum<V>(&mut self, _enum: &str, _visitor: V) -> Result<V::Value, Self::Error> where V: EnumVisitor

The visit_enum method allows a Deserialize type to inform the Deserializer that it's expecting an enum value. This allows deserializers that provide a custom enumeration serialization to properly deserialize the type.

fn visit_bytes<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor

The visit_bytes method allows a Deserialize type to inform the Deserializer that it's expecting a Vec<u8>. This allows deserializers that provide a custom byte vector serialization to properly deserialize the type.

Implementors