Skip to main content

Consume

Trait Consume 

Source
pub trait Consume<T> {
    // Required methods
    fn consume(self) -> Result<T>;
    fn consume_partial(self) -> Option<T>;
}
Expand description

Consumes a stream of bytes with little endianness to crate an object.

Required Methods§

Source

fn consume(self) -> Result<T>

Consumes the iterator to create an instance of T.

§Errors

Returns an [Error] if the stream terminates prematurely or contains excess bytes.

Source

fn consume_partial(self) -> Option<T>

Consumes the iterator partially to create an instance of T.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, I> Consume<T> for I
where T: FromLeStream, I: Iterator<Item = u8>,