Skip to main content

DecodeFrom

Trait DecodeFrom 

Source
pub trait DecodeFrom: Sized {
    // Required method
    fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>;
}
Expand description

TODO

Required Methods§

Source

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

Source§

fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>

Source§

impl DecodeFrom for bool

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>

Decodes a u16 from 2 bytes (little endian).

Source§

impl DecodeFrom for u32

Source§

fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>

Decodes a u32 from 4 bytes (little endian).

Source§

impl DecodeFrom for u64

Source§

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>
where K: DecodeFrom + Debug + Ord, V: DecodeFrom,

Available on crate feature alloc only.
Source§

fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>

TODO

Source§

impl<K, V> DecodeFrom for HashMap<K, V>
where K: DecodeFrom + Debug + Eq + Hash, V: DecodeFrom,

Available on crate feature std only.
Source§

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.
Source§

fn decode_from(decoder: &mut Decoder<impl InputSource>) -> Result<Self>

TODO

Implementors§