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
impl AsyncFileReader
Sourcepub fn info(&self) -> &OpenedFileInfo
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
impl AsyncInput for AsyncFileReader
Source§fn is_buffered(&self) -> bool
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>>
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>>
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> ⓘ
fn read_async<'a>( &'a mut self, output: &'a mut [Self::Item], ) -> ReadFuture<'a, Self> ⓘ
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> ⓘ
fn read_fully_async<'a>( &'a mut self, output: &'a mut [Self::Item], ) -> ReadFullyFuture<'a, Self> ⓘ
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> ⓘ
fn read_exactly_async<'a>( &'a mut self, output: &'a mut [Self::Item], ) -> ReadExactFuture<'a, Self> ⓘ
Creates a future that fills the entire destination. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for AsyncFileReader
impl !Sync for AsyncFileReader
impl !UnwindSafe for AsyncFileReader
impl Freeze for AsyncFileReader
impl Send for AsyncFileReader
impl Unpin for AsyncFileReader
impl UnsafeUnpin for AsyncFileReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more