Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder: Send + Send {
    type Error: Error;

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

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<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a bool value.

Source

fn decode_bytes<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a binary value.

Source

fn decode_i8<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting an i8 value.

Source

fn decode_i16<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting an i16 value.

Source

fn decode_i32<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting an i32 value.

Source

fn decode_i64<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting an i64 value.

Source

fn decode_u8<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a u8 value.

Source

fn decode_u16<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a u16 value.

Source

fn decode_u32<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a u32 value.

Source

fn decode_u64<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a u64 value.

Source

fn decode_f32<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a f32 value.

Source

fn decode_f64<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a f64 value.

Source

fn decode_array_bool<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_i8<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_i16<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_i32<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_i64<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_u8<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_u16<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_u32<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_u64<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_f32<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_array_f64<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_map<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_option<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_string<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

Hint that the FromStream type is expecting a string value.

Source

fn decode_tuple<V: Visitor>( &mut self, len: usize, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_uuid<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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

Source

fn decode_ignored_any<V: Visitor>( &mut self, visitor: V, ) -> impl Future<Output = Result<V::Value, Self::Error>> + Send

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§