Skip to main content

BlockRead

Trait BlockRead 

Source
pub trait BlockRead: Send + Sync {
    // Required methods
    fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>;
    fn size_bytes(&self) -> u64;
}
Expand description

Read-only random-access block device.

Required Methods§

Source

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>

Read exactly buf.len() bytes starting at offset (bytes from the start of the device).

Source

fn size_bytes(&self) -> u64

Total device size in bytes. Used for bounds checks.

Implementations on Foreign Types§

Source§

impl<T: BlockRead + ?Sized> BlockRead for &T

Source§

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>

Source§

fn size_bytes(&self) -> u64

Source§

impl<T: BlockRead + ?Sized> BlockRead for Box<T>

Source§

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>

Source§

fn size_bytes(&self) -> u64

Source§

impl<T: BlockRead + ?Sized> BlockRead for Arc<T>

Source§

fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<()>

Source§

fn size_bytes(&self) -> u64

Implementors§