Struct io::ByteReaderWrapper
source · pub struct ByteReaderWrapper<R: BlockReader>(/* private fields */);
Expand description
A wrapper struct that implements a byte-wise reader atop a block-based reader.
This ideally should be realized via automatic trait implementations,
in which all types that implement BlockReader
also implement ByteReader
,
but we can’t do that because Rust currently does not support specialization.
Example
Use the From
implementation around a BlockReader
instance, such as:
ⓘ
// Assume `storage_dev` implements `BlockReader`
let bytes_read = ByteReaderWrapper::from(storage_dev).read_at(...);
Trait Implementations§
source§impl<R> BlockIo for ByteReaderWrapper<R>where
R: BlockReader,
impl<R> BlockIo for ByteReaderWrapper<R>where R: BlockReader,
source§fn block_size(&self) -> usize
fn block_size(&self) -> usize
Returns the size in bytes of a single block (i.e., sector),
the minimum granularity of I/O transfers.
source§impl<R> BlockReader for ByteReaderWrapper<R>where
R: BlockReader,
impl<R> BlockReader for ByteReaderWrapper<R>where R: BlockReader,
source§impl<R> ByteReader for ByteReaderWrapper<R>where
R: BlockReader,
impl<R> ByteReader for ByteReaderWrapper<R>where R: BlockReader,
source§impl<R> From<R> for ByteReaderWrapper<R>where
R: BlockReader,
impl<R> From<R> for ByteReaderWrapper<R>where R: BlockReader,
source§impl<R> KnownLength for ByteReaderWrapper<R>where
R: KnownLength + BlockReader,
impl<R> KnownLength for ByteReaderWrapper<R>where R: KnownLength + BlockReader,
Auto Trait Implementations§
impl<R> RefUnwindSafe for ByteReaderWrapper<R>where R: RefUnwindSafe,
impl<R> Send for ByteReaderWrapper<R>where R: Send,
impl<R> Sync for ByteReaderWrapper<R>where R: Sync,
impl<R> Unpin for ByteReaderWrapper<R>where R: Unpin,
impl<R> UnwindSafe for ByteReaderWrapper<R>where R: UnwindSafe,
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