[][src]Trait ed::Decode

pub trait Decode: Sized {
    fn decode<R: Read>(input: R) -> Result<Self>;

    fn decode_into<R: Read>(&mut self, input: R) -> Result<()> { ... }
}

A trait for values that can be decoded from bytes deterministically.

Required methods

fn decode<R: Read>(input: R) -> Result<Self>

Reads bytes from the reader and returns the decoded value.

When possible, calling decode_into will often be more efficient since it lets the caller reuse memory to avoid allocating for fields with types such as Vec<T>.

Loading content...

Provided methods

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>

Reads bytes from the reader and mutates self to the decoded value.

This is often more efficient than calling decode when reading fields with heap-allocated types such as Vec<T> since it can reuse the memory already allocated in self.

When possible, implementations should recursively call decode_into on any child fields.

The default implementation of decode_into simply calls decode for ease of implementation, but should be overridden when in-place decoding is possible.

Loading content...

Implementations on Foreign Types

impl Decode for u8[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for u16[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for u32[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for u64[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for u128[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for i8[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for i16[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for i32[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for i64[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for i128[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the integer from fixed-size big-endian bytes.

impl Decode for bool[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the boolean from a single byte: 0 for false or 1 for true. Errors for any other value.

impl<T: Decode> Decode for Option<T>[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes a 0 byte as None, or a 1 byte followed by the encoding of the inner value as Some. Errors for all other values.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes a 0 byte as None, or a 1 byte followed by the encoding of the inner value as Some. Errors for all other values.

impl Decode for ()[src]

fn decode<R: Read>(_: R) -> Result<Self>[src]

Returns a unit tuple without reading any bytes.

impl<A: Decode> Decode for (A,)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<A: Decode + Terminated, B: Decode> Decode for (A, B)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<A: Decode + Terminated, B: Decode + Terminated, C: Decode> Decode for (A, B, C)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<A: Decode + Terminated, B: Decode + Terminated, C: Decode + Terminated, D: Decode> Decode for (A, B, C, D)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<A: Decode + Terminated, B: Decode + Terminated, C: Decode + Terminated, D: Decode + Terminated, E: Decode> Decode for (A, B, C, D, E)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<A: Decode + Terminated, B: Decode + Terminated, C: Decode + Terminated, D: Decode + Terminated, E: Decode + Terminated, F: Decode> Decode for (A, B, C, D, E, F)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<A: Decode + Terminated, B: Decode + Terminated, C: Decode + Terminated, D: Decode + Terminated, E: Decode + Terminated, F: Decode + Terminated, G: Decode> Decode for (A, B, C, D, E, F, G)[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the fields of the tuple one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the fields of the tuple one after another, in order.

Recursively calls decode_into for each field.

impl<T: Decode + Terminated> Decode for [T; 0][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 1][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 2][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 3][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 4][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 5][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 6][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 7][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 8][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 9][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 10][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 11][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 12][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 13][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 14][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 15][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 16][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 17][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 18][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 19][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 20][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 21][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 22][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 23][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 24][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 25][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 26][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 27][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 28][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 29][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 30][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 31][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 32][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 33][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 64][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 128][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for [T; 256][src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the array one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the elements of the array one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode + Terminated> Decode for Vec<T>[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the elements of the vector one after another, in order.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Encodes the elements of the vector one after another, in order.

Recursively calls decode_into for each element.

impl<T: Decode> Decode for Box<T>[src]

fn decode<R: Read>(input: R) -> Result<Self>[src]

Decodes the inner value into a new Box.

fn decode_into<R: Read>(&mut self, input: R) -> Result<()>[src]

Decodes the inner value into the existing Box.

Recursively calls decode_into on the inner value.

Loading content...

Implementors

Loading content...