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

pub trait Decoder: Send {
    type Error: Error;
#[must_use]    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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
;
#[must_use] 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
; }

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

Based on serde::de::Deserializer.

Associated Types

type Error: Error[src]

Type to return in case of a decoding error.

Loading content...

Required methods

#[must_use]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, 
[src]

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.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a bool value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting an i8 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting an i16 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting an i32 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting an i64 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a u8 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a u16 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a u32 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a u64 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a f32 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a f64 value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a string value.

#[must_use]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, 
[src]

Hint that the FromStream type is expecting a byte array.

#[must_use]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, 
[src]

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

#[must_use]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, 
[src]

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

#[must_use]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, 
[src]

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

#[must_use]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, 
[src]

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

#[must_use]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, 
[src]

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

#[must_use]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, 
[src]

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.

Loading content...

Implementors

Loading content...