[][src]Trait destream::de::Visitor

pub trait Visitor: Send + Sized {
    type Value;
    pub fn expecting(&self, formatter: &mut Formatter<'_>) -> Result;

    pub fn visit_bool<E: Error>(self, v: bool) -> Result<Self::Value, E> { ... }
pub fn visit_i8<E: Error>(self, v: i8) -> Result<Self::Value, E> { ... }
pub fn visit_i16<E: Error>(self, v: i16) -> Result<Self::Value, E> { ... }
pub fn visit_i32<E: Error>(self, v: i32) -> Result<Self::Value, E> { ... }
pub fn visit_i64<E: Error>(self, v: i64) -> Result<Self::Value, E> { ... }
pub fn visit_u8<E: Error>(self, v: u8) -> Result<Self::Value, E> { ... }
pub fn visit_u16<E: Error>(self, v: u16) -> Result<Self::Value, E> { ... }
pub fn visit_u32<E: Error>(self, v: u32) -> Result<Self::Value, E> { ... }
pub fn visit_u64<E: Error>(self, v: u64) -> Result<Self::Value, E> { ... }
pub fn visit_f32<E: Error>(self, v: f32) -> Result<Self::Value, E> { ... }
pub fn visit_f64<E: Error>(self, v: f64) -> Result<Self::Value, E> { ... }
pub fn visit_string<E: Error>(self, v: String) -> Result<Self::Value, E> { ... }
pub fn visit_byte_buf<E: Error>(self, _v: Vec<u8>) -> Result<Self::Value, E> { ... }
pub fn visit_unit<E: Error>(self) -> Result<Self::Value, E> { ... }
pub fn visit_none<E: Error>(self) -> Result<Self::Value, E> { ... }
#[must_use] pub fn visit_some<'life0, 'async_trait, D: Decoder>(
        self,
        _decoder: &'life0 mut D
    ) -> Pin<Box<dyn Future<Output = Result<Self::Value, D::Error>> + Send + 'async_trait>>
    where
        D: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] pub fn visit_map<'async_trait, A: MapAccess>(
        self,
        _map: A
    ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
    where
        A: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] pub fn visit_seq<'async_trait, A: SeqAccess>(
        self,
        _seq: A
    ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
    where
        A: 'async_trait,
        Self: 'async_trait
, { ... } }

This trait describes a visitor responsible for decoding a stream.

Based on serde::de::Visitor.

Associated Types

type Value[src]

The type which this Visitor is responsible for decoding.

Loading content...

Required methods

pub fn expecting(&self, formatter: &mut Formatter<'_>) -> Result[src]

Format a message stating what data this Visitor expects to receive.

This is used in error messages. The message should complete the sentence "This Visitor expects to receive ...", for example the message could be "an integer between 0 and 64". The message should not be capitalized and should not end with a period.

Loading content...

Provided methods

pub fn visit_bool<E: Error>(self, v: bool) -> Result<Self::Value, E>[src]

The input contains a boolean.

The default implementation fails with a type error.

pub fn visit_i8<E: Error>(self, v: i8) -> Result<Self::Value, E>[src]

The input contains an i8.

The default implementation forwards to visit_i64.

pub fn visit_i16<E: Error>(self, v: i16) -> Result<Self::Value, E>[src]

The input contains an i16.

The default implementation forwards to visit_i64.

pub fn visit_i32<E: Error>(self, v: i32) -> Result<Self::Value, E>[src]

The input contains an i32.

The default implementation forwards to visit_i64.

pub fn visit_i64<E: Error>(self, v: i64) -> Result<Self::Value, E>[src]

The input contains an i64.

The default implementation fails with a type error.

pub fn visit_u8<E: Error>(self, v: u8) -> Result<Self::Value, E>[src]

The input contains a u8.

The default implementation forwards to visit_u64.

pub fn visit_u16<E: Error>(self, v: u16) -> Result<Self::Value, E>[src]

The input contains a u16.

The default implementation forwards to visit_u64.

pub fn visit_u32<E: Error>(self, v: u32) -> Result<Self::Value, E>[src]

The input contains a u32.

The default implementation forwards to visit_u64.

pub fn visit_u64<E: Error>(self, v: u64) -> Result<Self::Value, E>[src]

The input contains a u64.

The default implementation fails with a type error.

pub fn visit_f32<E: Error>(self, v: f32) -> Result<Self::Value, E>[src]

The input contains an f32.

The default implementation forwards to visit_f64.

pub fn visit_f64<E: Error>(self, v: f64) -> Result<Self::Value, E>[src]

The input contains an f64.

The default implementation fails with a type error.

pub fn visit_string<E: Error>(self, v: String) -> Result<Self::Value, E>[src]

The input contains a string and ownership of the string is being given to the Visitor.

The default implementation fails with a type error.

pub fn visit_byte_buf<E: Error>(self, _v: Vec<u8>) -> Result<Self::Value, E>[src]

The input contains a byte array and ownership of the byte array is being given to the Visitor.

The default implementation fails with a type error.

pub fn visit_unit<E: Error>(self) -> Result<Self::Value, E>[src]

The input contains a unit ().

The default implementation fails with a type error.

pub fn visit_none<E: Error>(self) -> Result<Self::Value, E>[src]

The input contains an optional that is absent. The default implementation fails with a type error.

#[must_use]pub fn visit_some<'life0, 'async_trait, D: Decoder>(
    self,
    _decoder: &'life0 mut D
) -> Pin<Box<dyn Future<Output = Result<Self::Value, D::Error>> + Send + 'async_trait>> where
    D: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

The input contains an optional that is present. The default implementation fails with a type error.

#[must_use]pub fn visit_map<'async_trait, A: MapAccess>(
    self,
    _map: A
) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where
    A: 'async_trait,
    Self: 'async_trait, 
[src]

The input contains a key-value map. The default implementation fails with a type error.

#[must_use]pub fn visit_seq<'async_trait, A: SeqAccess>(
    self,
    _seq: A
) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where
    A: 'async_trait,
    Self: 'async_trait, 
[src]

The input contains a sequence of elements. The default implementation fails with a type error.

Loading content...

Implementors

Loading content...