[−][src]Trait destream::de::Decoder
A data format that can decode a given well-formatted stream using one or more Visitor
s.
Based on serde::de::Deserializer
.
Associated Types
Loading content...Required methods
#[must_use]pub 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]
&'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,
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
deserialize from self-describing formats only, ruling out Bincode and
many others.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a bool
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting an i8
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting an i16
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting an i32
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting an i64
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a u8
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a u16
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a u32
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a u64
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a f32
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a f64
value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a string value.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a byte array.
#[must_use]pub 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]
&'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,
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]pub 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]
&'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,
Hint that the FromStream
type is expecting a sequence of values.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a unit value (i.e. ()
).
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data.
#[must_use]pub 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]
&'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,
Hint that the FromStream
type is expecting a map of key-value pairs.
#[must_use]pub 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]
&'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,
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.