BlockSize

Trait BlockSize 

Source
pub trait BlockSize {
    // Required methods
    fn block_size_logical(&self) -> Result<u64>;
    fn block_count(&self) -> Result<u64>;
    fn block_size_physical(&self) -> Result<u64>;
}
Expand description

Some writable and readable devices (disk drives, media cards) have a block size (number of bytes that are read or written at a time) associated with them.

These devices also have a (relatively) fixed (or at least known) number of blocks that limits their length. At least, they can’t be appended to.

Required Methods§

Source

fn block_size_logical(&self) -> Result<u64>

The number of bytes in each logical block

Source

fn block_count(&self) -> Result<u64>

The total number of logical blocks

Source

fn block_size_physical(&self) -> Result<u64>

The number of bytes in each physical block

This is only a best guess. Many devices do not report a physical block size or do not report an accurate physical block size. Results will vary, be wary.

Implementors§

Source§

impl BlockSize for io_block::os::linux::BlockDev

Source§

impl BlockSize for io_block::os::BlockDev

Source§

impl<T> BlockSize for BlockFile<T>