Trait destream::de::Visitor

source ·
pub trait Visitor: Send + Sized {
    type Value;

Show 29 methods // Required method fn expecting() -> &'static str; // Provided methods fn visit_bool<E: Error>(self, v: bool) -> Result<Self::Value, E> { ... } fn visit_i8<E: Error>(self, v: i8) -> Result<Self::Value, E> { ... } fn visit_i16<E: Error>(self, v: i16) -> Result<Self::Value, E> { ... } fn visit_i32<E: Error>(self, v: i32) -> Result<Self::Value, E> { ... } fn visit_i64<E: Error>(self, v: i64) -> Result<Self::Value, E> { ... } fn visit_u8<E: Error>(self, v: u8) -> Result<Self::Value, E> { ... } fn visit_u16<E: Error>(self, v: u16) -> Result<Self::Value, E> { ... } fn visit_u32<E: Error>(self, v: u32) -> Result<Self::Value, E> { ... } fn visit_u64<E: Error>(self, v: u64) -> Result<Self::Value, E> { ... } fn visit_f32<E: Error>(self, v: f32) -> Result<Self::Value, E> { ... } fn visit_f64<E: Error>(self, v: f64) -> Result<Self::Value, E> { ... } fn visit_array_bool<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<bool>, Self: 'async_trait { ... } fn visit_array_i8<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<i8>, Self: 'async_trait { ... } fn visit_array_i16<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<i16>, Self: 'async_trait { ... } fn visit_array_i32<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<i32>, Self: 'async_trait { ... } fn visit_array_i64<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<i64>, Self: 'async_trait { ... } fn visit_array_u8<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<u8>, Self: 'async_trait { ... } fn visit_array_u16<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<u16>, Self: 'async_trait { ... } fn visit_array_u32<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<u32>, Self: 'async_trait { ... } fn visit_array_u64<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<u64>, Self: 'async_trait { ... } fn visit_array_f32<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<f32>, Self: 'async_trait { ... } fn visit_array_f64<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + ArrayAccess<f64>, Self: 'async_trait { ... } fn visit_string<E: Error>(self, v: String) -> Result<Self::Value, E> { ... } fn visit_unit<E: Error>(self) -> Result<Self::Value, E> { ... } fn visit_none<E: Error>(self) -> Result<Self::Value, E> { ... } fn visit_some<'life0, 'async_trait, D>( self, decoder: &'life0 mut D ) -> Pin<Box<dyn Future<Output = Result<Self::Value, D::Error>> + Send + 'async_trait>> where D: 'async_trait + Decoder, Self: 'async_trait, 'life0: 'async_trait { ... } fn visit_map<'async_trait, A>( self, map: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + MapAccess, Self: 'async_trait { ... } fn visit_seq<'async_trait, A>( self, seq: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>> where A: 'async_trait + SeqAccess, Self: 'async_trait { ... }
}
Expand description

This trait describes a visitor responsible for decoding a stream.

Based on serde::de::Visitor.

Required Associated Types§

source

type Value

The type which this Visitor is responsible for decoding.

Required Methods§

source

fn expecting() -> &'static str

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.

Provided Methods§

source

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

The input contains a boolean.

The default implementation fails with a type error.

source

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

The input contains an i8.

The default implementation forwards to visit_i64.

source

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

The input contains an i16.

The default implementation forwards to visit_i64.

source

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

The input contains an i32.

The default implementation forwards to visit_i64.

source

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

The input contains an i64.

The default implementation fails with a type error.

source

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

The input contains a u8.

The default implementation forwards to visit_u64.

source

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

The input contains a u16.

The default implementation forwards to visit_u64.

source

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

The input contains a u32.

The default implementation forwards to visit_u64.

source

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

The input contains a u64.

The default implementation fails with a type error.

source

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

The input contains an f32.

The default implementation forwards to visit_f64.

source

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

The input contains an f64.

The default implementation fails with a type error.

source

fn visit_array_bool<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<bool>, Self: 'async_trait,

The input contains an array of bools.

The default implementation fails with a type error.

source

fn visit_array_i8<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<i8>, Self: 'async_trait,

The input contains an array of i8s.

The default implementation fails with a type error.

source

fn visit_array_i16<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<i16>, Self: 'async_trait,

The input contains an array of i16s.

The default implementation fails with a type error.

source

fn visit_array_i32<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<i32>, Self: 'async_trait,

The input contains an array of i32s.

The default implementation fails with a type error.

source

fn visit_array_i64<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<i64>, Self: 'async_trait,

The input contains an array of i64s.

The default implementation fails with a type error.

source

fn visit_array_u8<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<u8>, Self: 'async_trait,

The input contains an array of u8s.

The default implementation fails with a type error.

source

fn visit_array_u16<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<u16>, Self: 'async_trait,

The input contains an array of u16s.

The default implementation fails with a type error.

source

fn visit_array_u32<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<u32>, Self: 'async_trait,

The input contains an array of u32s.

The default implementation fails with a type error.

source

fn visit_array_u64<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<u64>, Self: 'async_trait,

The input contains an array of u64s.

The default implementation fails with a type error.

source

fn visit_array_f32<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<f32>, Self: 'async_trait,

The input contains an array of f32s.

The default implementation fails with a type error.

source

fn visit_array_f64<'async_trait, A>( self, array: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + ArrayAccess<f64>, Self: 'async_trait,

The input contains an array of f64s.

The default implementation fails with a type error.

source

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

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

The default implementation fails with a type error.

source

fn visit_unit<E: Error>(self) -> Result<Self::Value, E>

The input contains a unit ().

The default implementation fails with a type error.

source

fn visit_none<E: Error>(self) -> Result<Self::Value, E>

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

source

fn visit_some<'life0, 'async_trait, D>( self, decoder: &'life0 mut D ) -> Pin<Box<dyn Future<Output = Result<Self::Value, D::Error>> + Send + 'async_trait>>
where D: 'async_trait + Decoder, Self: 'async_trait, 'life0: 'async_trait,

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

source

fn visit_map<'async_trait, A>( self, map: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + MapAccess, Self: 'async_trait,

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

source

fn visit_seq<'async_trait, A>( self, seq: A ) -> Pin<Box<dyn Future<Output = Result<Self::Value, A::Error>> + Send + 'async_trait>>
where A: 'async_trait + SeqAccess, Self: 'async_trait,

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

Object Safety§

This trait is not object safe.

Implementors§