Trait destream::de::Decoder

source ·
pub trait Decoder: Send {
    type Error: Error;

Show 32 methods // Required methods fn decode_any<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_bool<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_bytes<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_i8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_i16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_i32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_i64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_u8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_u16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_u32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_u64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_f32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_f64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_bool<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_i8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_i16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_i32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_i64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_u8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_u16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_u32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_u64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_f32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_array_f64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_map<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_option<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_seq<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_string<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_tuple<'life0, 'async_trait, V>( &'life0 mut self, len: usize, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_unit<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_uuid<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait; fn decode_ignored_any<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>> where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: '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.

Required Associated Types§

source

type Error: Error

Type to return in case of a decoding error.

Required Methods§

source

fn decode_any<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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.

source

fn decode_bool<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a bool value.

source

fn decode_bytes<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a binary value.

source

fn decode_i8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting an i8 value.

source

fn decode_i16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting an i16 value.

source

fn decode_i32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting an i32 value.

source

fn decode_i64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting an i64 value.

source

fn decode_u8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a u8 value.

source

fn decode_u16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a u16 value.

source

fn decode_u32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a u32 value.

source

fn decode_u64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a u64 value.

source

fn decode_f32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a f32 value.

source

fn decode_f64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a f64 value.

source

fn decode_array_bool<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_i8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_i16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_i32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_i64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_u8<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_u16<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_u32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_u64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_f32<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_array_f64<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_map<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_option<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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).

source

fn decode_seq<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_string<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a string value.

source

fn decode_tuple<'life0, 'async_trait, V>( &'life0 mut self, len: usize, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_unit<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn decode_uuid<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

Hint that the FromStream type is expecting a uuid::Uuid.

source

fn decode_ignored_any<'life0, 'async_trait, V>( &'life0 mut self, visitor: V ) -> Pin<Box<dyn Future<Output = Result<V::Value, Self::Error>> + Send + 'async_trait>>
where V: 'async_trait + Visitor, Self: 'async_trait, 'life0: 'async_trait,

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.

Object Safety§

This trait is not object safe.

Implementors§