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§
Required Methods§
Sourcefn decode_any<V: Visitor>(
&mut self,
visitor: V,
) -> impl Future<Output = Result<V::Value, Self::Error>> + Send
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.
Sourcefn decode_bool<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
Hint that the FromStream type is expecting a bool value.
Sourcefn decode_bytes<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
Hint that the FromStream type is expecting a binary value.
Sourcefn decode_i8<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
Hint that the FromStream type is expecting an i8 value.
Sourcefn decode_i16<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
Hint that the FromStream type is expecting an i16 value.
Sourcefn decode_i32<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
Hint that the FromStream type is expecting an i32 value.
Sourcefn decode_i64<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
Hint that the FromStream type is expecting an i64 value.
Sourcefn decode_u8<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
Hint that the FromStream type is expecting a u8 value.
Sourcefn decode_u16<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
Hint that the FromStream type is expecting a u16 value.
Sourcefn decode_u32<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
Hint that the FromStream type is expecting a u32 value.
Sourcefn decode_u64<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
Hint that the FromStream type is expecting a u64 value.
Sourcefn decode_f32<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
Hint that the FromStream type is expecting a f32 value.
Sourcefn decode_f64<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
Hint that the FromStream type is expecting a f64 value.
Sourcefn decode_array_bool<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
Hint that the FromStream type is expecting an array of bools.
Sourcefn decode_array_i8<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
Hint that the FromStream type is expecting an array of i8s.
Sourcefn decode_array_i16<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
Hint that the FromStream type is expecting an array of i16s.
Sourcefn decode_array_i32<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
Hint that the FromStream type is expecting an array of i32s.
Sourcefn decode_array_i64<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
Hint that the FromStream type is expecting an array of i64s.
Sourcefn decode_array_u8<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
Hint that the FromStream type is expecting an array of u8s.
Sourcefn decode_array_u16<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
Hint that the FromStream type is expecting an array of u16s.
Sourcefn decode_array_u32<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
Hint that the FromStream type is expecting an array of u32s.
Sourcefn decode_array_u64<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
Hint that the FromStream type is expecting an array of u64s.
Sourcefn decode_array_f32<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
Hint that the FromStream type is expecting an array of f32s.
Sourcefn decode_array_f64<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
Hint that the FromStream type is expecting an array of f64s.
Sourcefn decode_map<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
Hint that the FromStream type is expecting a map of key-value pairs.
Sourcefn decode_option<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
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).
Sourcefn decode_seq<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
Hint that the FromStream type is expecting a sequence of values.
Sourcefn decode_string<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
Hint that the FromStream type is expecting a string value.
Sourcefn decode_tuple<V: Visitor>(
&mut self,
len: usize,
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
Hint that the FromStream type is expecting a sequence of values and
knows how many values there are without looking at the encoded data.
Sourcefn decode_unit<V: Visitor>(
&mut self,
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
Hint that the FromStream type is expecting a unit value (i.e. ()).
Sourcefn decode_uuid<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
Hint that the FromStream type is expecting a uuid::Uuid.
Sourcefn decode_ignored_any<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
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.