Skip to main content

AsyncFileReader

Struct AsyncFileReader 

Source
pub struct AsyncFileReader { /* private fields */ }
Expand description

Type-erased asynchronous byte input associated with an opened file.

§Examples

This example uses an isolated in-memory provider fixture.

use qubit_fs::Path;
use qubit_fs::read::ReadOptions;
use qubit_io::AsyncInput;

let mut reader = filesystem.open_reader(&Path::parse("/report")?, ReadOptions::default()).await?;
let mut prefix = [0; 3];
assert_eq!(3, reader.read_fully_async(&mut prefix).await?);
assert_eq!(*b"byt", prefix);

Implementations§

Source§

impl AsyncFileReader

Source

pub fn info(&self) -> &OpenedFileInfo

Returns the fixed identity and open-time metadata snapshot.

§Returns

Information captured when the reader was opened.

Trait Implementations§

Source§

impl AsyncInput for AsyncFileReader

Source§

type Item = u8

The item type read from this input.
Source§

fn is_buffered(&self) -> bool

Returns whether this input already buffers items internally. Read more
Source§

unsafe fn poll_read_unchecked( self: Pin<&mut Self>, cx: &mut Context<'_>, output: &mut [u8], index: usize, count: usize, ) -> Poll<IoResult<usize>>

Polls an indexed read without checking the destination range. Read more
Source§

fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, output: &mut [Self::Item], ) -> Poll<Result<usize, Error>>

Polls a read into the full destination slice. Read more
Source§

fn read_async<'a>( &'a mut self, output: &'a mut [Self::Item], ) -> ReadFuture<'a, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that performs one asynchronous read operation. Read more
Source§

fn read_fully_async<'a>( &'a mut self, output: &'a mut [Self::Item], ) -> ReadFullyFuture<'a, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that fills a destination as far as possible. Read more
Source§

fn read_exactly_async<'a>( &'a mut self, output: &'a mut [Self::Item], ) -> ReadExactFuture<'a, Self> ⓘ
where Self: Sized + Unpin,

Creates a future that fills the entire destination. Read more
Source§

impl Debug for AsyncFileReader

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.