IOReader

Struct IOReader 

Source
pub struct IOReader<'de, T>
where T: Read,
{ reader: T, buff: SlidingBuffer<'de>, }
Expand description

Wrapper over a std::io::Read and a sliding buffer to implement the Flavor trait

Fields§

§reader: T§buff: SlidingBuffer<'de>

Implementations§

Source§

impl<'de, T> IOReader<'de, T>
where T: Read,

Source

pub fn new(reader: T, buff: &'de mut [u8]) -> Self

Create a new IOReader from a reader and a buffer.

buff must have enough space to hold all data read during the deserialisation.

Trait Implementations§

Source§

impl<'de, T> Flavor<'de> for IOReader<'de, T>
where T: Read + 'de,

Source§

fn finalize(self) -> Result<(T, &'de mut [u8])>

Return the remaining (unused) bytes in the Deserializer

Source§

type Remainder = (T, &'de mut [u8])

The remaining data of this flavor after deserializing has completed. Read more
Source§

type Source = &'de [u8]

The source of data retrieved for deserialization. Read more
Source§

fn pop(&mut self) -> Result<u8>

Obtain the next byte for deserialization
Source§

fn size_hint(&self) -> Option<usize>

Returns the number of bytes remaining in the message, if known. Read more
Source§

fn try_take_n(&mut self, ct: usize) -> Result<&'de [u8]>

Attempt to take the next ct bytes from the serialized message. Read more
Source§

fn try_take_n_temp<'a>(&'a mut self, ct: usize) -> Result<&'a [u8]>
where 'de: 'a,

Attempt to take the next ct bytes from the serialized message. Read more

Auto Trait Implementations§

§

impl<'de, T> Freeze for IOReader<'de, T>
where T: Freeze,

§

impl<'de, T> RefUnwindSafe for IOReader<'de, T>
where T: RefUnwindSafe,

§

impl<'de, T> !Send for IOReader<'de, T>

§

impl<'de, T> !Sync for IOReader<'de, T>

§

impl<'de, T> Unpin for IOReader<'de, T>
where T: Unpin,

§

impl<'de, T> UnwindSafe for IOReader<'de, T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.