pub trait DecodeFrom: Sized {
// Required method
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>;
}Expand description
TODO
Required Methods§
Sourcefn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a value of this type from the provided decoder.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl DecodeFrom for String
Available on crate feature alloc only.TODO
impl DecodeFrom for String
alloc only.TODO
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Source§impl DecodeFrom for bool
impl DecodeFrom for bool
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Reads a single byte from the buffer and returns false if it is 0 or true if it is 1.
If the byte has any other value, an error is returned instead.
Source§impl DecodeFrom for f32
impl DecodeFrom for f32
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a f32 from 4 bytes (little endian) using the “binary32” representation defined in IEEE 754-2008.
Source§impl DecodeFrom for f64
impl DecodeFrom for f64
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a f64 from 8 bytes (little endian) using the “binary64” representation defined in IEEE 754-2008.
Source§impl DecodeFrom for i8
impl DecodeFrom for i8
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Reads a single byte directly from the buffer and returns it, as-if it was an i8.
Source§impl DecodeFrom for i16
impl DecodeFrom for i16
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a i16 from 2 bytes (little endian) in two’s complement form.
Source§impl DecodeFrom for i32
impl DecodeFrom for i32
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a i32 from 4 bytes (little endian) in two’s complement form.
Source§impl DecodeFrom for i64
impl DecodeFrom for i64
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a i64 from 8 bytes (little endian) in two’s complement form.
Source§impl DecodeFrom for u8
impl DecodeFrom for u8
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Reads a single byte directly from the buffer and returns it, as is.
Source§impl DecodeFrom for u16
impl DecodeFrom for u16
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a u16 from 2 bytes (little endian).
Source§impl DecodeFrom for u32
impl DecodeFrom for u32
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a u32 from 4 bytes (little endian).
Source§impl DecodeFrom for u64
impl DecodeFrom for u64
Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
Decodes a u64 from 8 bytes (little endian).
Source§impl<K, V> DecodeFrom for BTreeMap<K, V>
Available on crate feature alloc only.
impl<K, V> DecodeFrom for BTreeMap<K, V>
alloc only.Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
TODO
Source§impl<K, V> DecodeFrom for HashMap<K, V>
Available on crate feature std only.
impl<K, V> DecodeFrom for HashMap<K, V>
std only.Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
TODO
Source§impl<T> DecodeFrom for Vec<T>where
T: DecodeFrom,
Available on crate feature alloc only.
impl<T> DecodeFrom for Vec<T>where
T: DecodeFrom,
alloc only.Source§fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>
TODO