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
impl Deserializer for UnitDeserializer
impl Deserializer for BoolDeserializer
impl Deserializer for I8Deserializer
impl Deserializer for I16Deserializer
impl Deserializer for I32Deserializer
impl Deserializer for I64Deserializer
impl Deserializer for IsizeDeserializer
impl Deserializer for U8Deserializer
impl Deserializer for U16Deserializer
impl Deserializer for U32Deserializer
impl Deserializer for U64Deserializer
impl Deserializer for UsizeDeserializer
impl Deserializer for F32Deserializer
impl Deserializer for F64Deserializer
impl Deserializer for CharDeserializer
impl<'a> Deserializer for StrDeserializer<'a>
impl Deserializer for StringDeserializer
impl<I, T> Deserializer for SeqDeserializer<I> where I: Iterator<Item=T>, T: ValueDeserializer
impl<I, K, V> Deserializer for MapDeserializer<I, K, V> where I: Iterator<Item=(K, V)>, K: ValueDeserializer, V: ValueDeserializer
impl<Iter> Deserializer for Deserializer<Iter> where Iter: Iterator<Item=Result<u8>>
impl Deserializer for Deserializer