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

Returns the size in bytes of a single block (i.e., sector), the minimum granularity of I/O transfers. Read more

Reads blocks of data from this reader into the given buffer. Read more

Reads bytes of data from this reader into the given buffer. Read more

Converts to this type from the input type.

Returns the length (size in bytes) of this I/O stream or device.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts to this type from the input type.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.