Trait destream::de::Decoder[][src]

pub trait Decoder: Send {
    type Error: Error;
Show methods fn decode_any<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_bool<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_i8<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_i16<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_i32<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_i64<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_u8<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_u16<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_u32<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_u64<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_f32<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_f64<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_bool<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_i8<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_i16<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_i32<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_i64<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_u8<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_u16<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_u32<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_u64<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_f32<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_array_f64<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_string<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_byte_buf<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_option<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_seq<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_unit<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_tuple<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        len: usize,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_map<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn decode_ignored_any<'life0, 'async_trait, V: Visitor>(
        &'life0 mut self,
        visitor: V
    ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
    where
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
}
Expand description

A data format that can decode a given well-formatted stream using one or more Visitors.

Based on serde::de::Deserializer.

Associated Types

Type to return in case of a decoding error.

Required methods

Require the Decoder to figure out how to drive the visitor based on what data type is in the input.

When implementing FromStream, you should avoid relying on Decoder::decode_any unless you need to be told by the Decoder what type is in the input. Know that relying on Decoder::decode_any means your data type will be able to decode self-describing formats only.

Hint that the FromStream type is expecting a bool value.

Hint that the FromStream type is expecting an i8 value.

Hint that the FromStream type is expecting an i16 value.

Hint that the FromStream type is expecting an i32 value.

Hint that the FromStream type is expecting an i64 value.

Hint that the FromStream type is expecting a u8 value.

Hint that the FromStream type is expecting a u16 value.

Hint that the FromStream type is expecting a u32 value.

Hint that the FromStream type is expecting a u64 value.

Hint that the FromStream type is expecting a f32 value.

Hint that the FromStream type is expecting a f64 value.

Hint that the FromStream type is expecting an array of bools.

Hint that the FromStream type is expecting an array of i8s.

Hint that the FromStream type is expecting an array of i16s.

Hint that the FromStream type is expecting an array of i32s.

Hint that the FromStream type is expecting an array of i64s.

Hint that the FromStream type is expecting an array of u8s.

Hint that the FromStream type is expecting an array of u16s.

Hint that the FromStream type is expecting an array of u32s.

Hint that the FromStream type is expecting an array of u64s.

Hint that the FromStream type is expecting an array of f32s.

Hint that the FromStream type is expecting an array of f64s.

Hint that the FromStream type is expecting a string value.

Hint that the FromStream type is expecting a byte array.

Hint that the FromStream type is expecting an optional value.

This allows decoders that encode an optional value as a nullable value to convert the null value into None and a regular value into Some(value).

Hint that the FromStream type is expecting a sequence of values.

Hint that the FromStream type is expecting a unit value (i.e. ()).

Hint that the FromStream type is expecting a sequence of values and knows how many values there are without looking at the encoded data.

Hint that the FromStream type is expecting a map of key-value pairs.

Hint that the FromStream type needs to decode a value whose type doesn’t matter because it is ignored.

Decoders for non-self-describing formats may not support this mode.

Implementors