Trait BlockDeviceExt

Source
pub trait BlockDeviceExt {
    // Required method
    fn get_device_path(&self) -> &Path;

    // Provided methods
    fn sys_block_path(&self) -> PathBuf { ... }
    fn is_read_only(&self) -> bool { ... }
    fn is_removable(&self) -> bool { ... }
    fn is_rotational(&self) -> bool { ... }
    fn get_mount_point(&self) -> Option<&Path> { ... }
    fn get_device_name(&self) -> &str { ... }
    fn get_sectors(&self) -> u64 { ... }
    fn get_logical_block_size(&self) -> u64 { ... }
    fn get_physical_block_size(&self) -> u64 { ... }
}
Expand description

Methods that all block devices share, whether they are partitions or disks.

This trait is required to implement other disk traits.

Required Methods§

Source

fn get_device_path(&self) -> &Path

The path to the block device, such as /dev/sda1, or /dev/data/root.

Provided Methods§

Source

fn sys_block_path(&self) -> PathBuf

The sys path of the block device.

Source

fn is_read_only(&self) -> bool

Checks if the device is a read-only device.

Source

fn is_removable(&self) -> bool

Checks if the device is a removable device.

§Notes

This is only applicable for disk devices.

Source

fn is_rotational(&self) -> bool

Checks if the device is a rotational device.

§Notes

This is only applicable for disk devices.

Source

fn get_mount_point(&self) -> Option<&Path>

The mount point of this block device, if it is mounted.

Source

fn get_device_name(&self) -> &str

The name of the device, such as sda1.

Source

fn get_sectors(&self) -> u64

The combined total number of sectors on the disk.

Source

fn get_logical_block_size(&self) -> u64

The size of each logical sector, in bytes.

Source

fn get_physical_block_size(&self) -> u64

The size of each logical sector, in bytes.

Implementors§