Skip to main content

EnsuredBufferedInput

Enum EnsuredBufferedInput 

Source
pub enum EnsuredBufferedInput<I>
where I: Input, I::Item: Copy + Default,
{ AlreadyBuffered(I), Buffered(BufferedInput<I>), }
Expand description

Input value that is guaranteed to report itself as buffered.

This enum is returned by BufferedInput::ensure. It keeps an input that already buffers items as-is, and wraps an unbuffered input in BufferedInput. Operations delegate to the selected branch.

Variants§

§

AlreadyBuffered(I)

The original input already reported itself as buffered.

§

Buffered(BufferedInput<I>)

The original input was wrapped in BufferedInput.

Trait Implementations§

Source§

impl<I> Input for EnsuredBufferedInput<I>
where I: Input, I::Item: Copy + Default,

Source§

fn is_buffered(&self) -> bool

Reports that this input is buffered.

Source§

unsafe fn read_unchecked( &mut self, output: &mut [Self::Item], index: usize, count: usize, ) -> Result<usize>

Reads items from the selected input branch.

Source§

fn read(&mut self, output: &mut [Self::Item]) -> Result<usize>

Reads items into the full output slice.

Source§

unsafe fn read_fully_unchecked( &mut self, output: &mut [Self::Item], index: usize, count: usize, ) -> Result<usize>

Reads items until the indexed output range is full or EOF is reached.

Source§

fn read_fully(&mut self, output: &mut [Self::Item]) -> Result<usize>

Reads items into the full output slice until it is full or EOF is reached.

Source§

type Item = <I as Input>::Item

The item type read from this input.
Source§

impl<I> Seekable for EnsuredBufferedInput<I>
where I: SeekableInput, <I as Input>::Item: Copy + Default,

Source§

fn seek_to(&mut self, position: SeekFrom) -> Result<u64>

Seeks in item offsets through the selected input branch.

Source§

type Unit = <I as Input>::Item

The unit type used to measure seek positions and offsets.

Auto Trait Implementations§

§

impl<I> Freeze for EnsuredBufferedInput<I>
where <I as Input>::Item: Sized, I: Freeze,

§

impl<I> RefUnwindSafe for EnsuredBufferedInput<I>

§

impl<I> Send for EnsuredBufferedInput<I>
where <I as Input>::Item: Sized + Send, I: Send,

§

impl<I> Sync for EnsuredBufferedInput<I>
where <I as Input>::Item: Sized + Sync, I: Sync,

§

impl<I> Unpin for EnsuredBufferedInput<I>
where <I as Input>::Item: Sized + Unpin, I: Unpin,

§

impl<I> UnsafeUnpin for EnsuredBufferedInput<I>
where <I as Input>::Item: Sized, I: UnsafeUnpin,

§

impl<I> UnwindSafe for EnsuredBufferedInput<I>
where <I as Input>::Item: Sized + UnwindSafe, I: 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> SeekableInput for T
where T: Input + Seekable<Unit = <T as Input>::Item>,

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.