use crate::{FromLeStream, Result};
pub trait Consume<T> {
fn consume(self) -> Result<T>;
fn consume_partial(self) -> Option<T>;
}
impl<T, I> Consume<T> for I
where
T: FromLeStream,
I: Iterator<Item = u8>,
{
fn consume(self) -> Result<T> {
T::from_le_stream_exact(self)
}
fn consume_partial(self) -> Option<T> {
T::from_le_stream(self)
}
}