Struct io::ByteReaderWrapper
source · pub struct ByteReaderWrapper<R: BlockReader>(_);
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.