Skip to main content

IoReader

Struct IoReader 

Source
pub struct IoReader<R> { /* private fields */ }
Available on crate feature std only.
Expand description

A reader that reads from a std::io::Read.

Implementations§

Source§

impl<R> IoReader<R>

Source

pub const fn new(reader: R) -> Self

Create a new IoReader from the given reader.

Trait Implementations§

Source§

impl<R> Reader for IoReader<R>
where R: Read,

Source§

fn read(&mut self, bytes: &mut [u8]) -> Result<(), DecodeError>

Fill the given bytes argument with values. Exactly the length of the given slice must be filled, or else an error must be returned. Read more
Source§

fn read_u8(&mut self) -> Result<u8, DecodeError>

Read a single byte from the reader. Read more
Source§

fn read_u16(&mut self) -> Result<u16, DecodeError>

Read a u16 from the reader. Read more
Source§

fn read_u32(&mut self) -> Result<u32, DecodeError>

Read a u32 from the reader. Read more
Source§

fn read_u64(&mut self) -> Result<u64, DecodeError>

Read a u64 from the reader. Read more
Source§

fn read_u128(&mut self) -> Result<u128, DecodeError>

Read a u128 from the reader. Read more
Source§

fn peek_read(&mut self, _: usize) -> Option<&[u8]>

If this reader wraps a buffer of any kind, this function lets callers access contents of the buffer without passing data through a buffer first.
Source§

fn consume(&mut self, _: usize)

If an implementation of peek_read is provided, an implementation of this function must be provided so that subsequent reads or peek-reads do not return the same bytes
Source§

fn peek_u8(&mut self) -> Option<u8>

Returns the next byte without consuming it.

Auto Trait Implementations§

§

impl<R> Freeze for IoReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for IoReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for IoReader<R>
where R: Send,

§

impl<R> Sync for IoReader<R>
where R: Sync,

§

impl<R> Unpin for IoReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for IoReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for IoReader<R>
where R: 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.