pub struct BufferedAsyncReadAt<T> { /* private fields */ }
Expand description
Wraps an AsyncReadAt
with an in-memory buffer of size fidl_fuchsia_io::MAX_TRANSFER_SIZE
in which it stores the results of poll_read_at
calls made to the wrapped AsyncReadAt
.
Calls to poll_read_at
that begin in the buffer will be serviced only from the buffer
without interacting with the wrapped AsyncReadAt
, therefore the read will be short if the
buffer ends before the requested range.
Calls to poll_read_at
that do not begin in the buffer will be forwarded
to the wrapped AsyncReadAt
with the length of the forwarded buffer always exactly
fidl_fuchsia_io::MAX_TRANSFER_SIZE
, therefore calls to poll_read_at
requesting more than
fidl_fuchsia_io::MAX_TRANSFER_SIZE
bytes will always be short.
Implementations§
Source§impl<T> BufferedAsyncReadAt<T>
impl<T> BufferedAsyncReadAt<T>
Trait Implementations§
Source§impl<T: AsyncGetSize> AsyncGetSize for BufferedAsyncReadAt<T>
impl<T: AsyncGetSize> AsyncGetSize for BufferedAsyncReadAt<T>
Source§impl<T: AsyncReadAt> AsyncReadAt for BufferedAsyncReadAt<T>
impl<T: AsyncReadAt> AsyncReadAt for BufferedAsyncReadAt<T>
Source§fn poll_read_at(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
offset_u64: u64,
buf: &mut [u8],
) -> Poll<Result<usize>>
fn poll_read_at( self: Pin<&mut Self>, cx: &mut Context<'_>, offset_u64: u64, buf: &mut [u8], ) -> Poll<Result<usize>>
Attempt to read at most
buf.len()
bytes starting at offset
into buf
. On success
returns the number of bytes read.
Contents of buf
are only altered on success.
Reads of more than zero but fewer than buf.len()
bytes do NOT indicate EOF.
Reads of zero bytes only occur if buf.len() == 0
or EOF.impl<'pin, T> Unpin for BufferedAsyncReadAt<T>where
__BufferedAsyncReadAt<'pin, T>: Unpin,
Auto Trait Implementations§
impl<T> Freeze for BufferedAsyncReadAt<T>where
T: Freeze,
impl<T> RefUnwindSafe for BufferedAsyncReadAt<T>where
T: RefUnwindSafe,
impl<T> Send for BufferedAsyncReadAt<T>where
T: Send,
impl<T> Sync for BufferedAsyncReadAt<T>where
T: Sync,
impl<T> UnwindSafe for BufferedAsyncReadAt<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsyncGetSizeExt for Twhere
T: AsyncGetSize + ?Sized,
impl<T> AsyncGetSizeExt for Twhere
T: AsyncGetSize + ?Sized,
Source§impl<T> AsyncReadAtExt for Twhere
T: AsyncReadAt + ?Sized,
impl<T> AsyncReadAtExt for Twhere
T: AsyncReadAt + ?Sized,
Source§fn read_at<'a>(&'a mut self, offset: u64, buf: &'a mut [u8]) -> ReadAt<'a, Self>where
Self: Unpin,
fn read_at<'a>(&'a mut self, offset: u64, buf: &'a mut [u8]) -> ReadAt<'a, Self>where
Self: Unpin,
Returns a future that reads at
offset
, and fill buf
, on success the number of bytes
read is returned.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