Trait svbyte::Decoder

source ·
pub trait Decoder<T: Copy + From<u8>> {
    // Required method
    fn decode(&mut self, buffer: &mut [T]) -> Result<usize>;

    // Provided method
    fn to_vec(self) -> Result<Vec<T>>
       where Self: Sized { ... }
}
Expand description

Represents an object that can decode a stream of data into a buffer of fixed size. A type parameter T specifies /// the type of the elements in the buffer.

Required Methods§

source

fn decode(&mut self, buffer: &mut [T]) -> Result<usize>

Decodes next elements into the buffer

Decodes next elements and returns the number of decoded elements, or zero if the end of the stream is reached. There is no guarantee about buffer element past the return value. They might be left unchanged or zeroed out by this method.

Provided Methods§

source

fn to_vec(self) -> Result<Vec<T>>where Self: Sized,

Returns the content of a stream in a Vec

Implementors§