pub trait PartitionExt: BlockDeviceExt {
Show 17 methods
// Required methods
fn get_file_system(&self) -> Option<FileSystem>;
fn get_partition_flags(&self) -> &[PartitionFlag];
fn get_partition_label(&self) -> Option<&str>;
fn get_partition_type(&self) -> PartitionType;
fn get_sector_end(&self) -> u64;
fn get_sector_start(&self) -> u64;
// Provided methods
fn get_sectors(&self) -> u64 { ... }
fn is_esp_partition(&self) -> bool { ... }
fn is_linux_compatible(&self) -> bool { ... }
fn is_luks(&self) -> bool { ... }
fn is_swap(&self) -> bool { ... }
fn probe<T, F>(&self, func: F) -> T
where F: FnMut(Option<(&Path, UnmountDrop<Mount>)>) -> T { ... }
fn probe_os(&self) -> Option<OS> { ... }
fn sectors_differ_from<P: PartitionExt>(&self, other: &P) -> bool { ... }
fn sector_lies_within(&self, sector: u64) -> bool { ... }
fn sectors_overlap(&self, start: u64, end: u64) -> bool { ... }
fn sectors_used(&self) -> Result<u64> { ... }
}
Expand description
Trait to provide methods for interacting with partition-based block device.
Required Methods§
Sourcefn get_file_system(&self) -> Option<FileSystem>
fn get_file_system(&self) -> Option<FileSystem>
Defines the file system that this device was partitioned with.
Sourcefn get_partition_flags(&self) -> &[PartitionFlag]
fn get_partition_flags(&self) -> &[PartitionFlag]
Ped partition flags that this disk has been assigned.
Sourcefn get_partition_label(&self) -> Option<&str>
fn get_partition_label(&self) -> Option<&str>
The label of the partition, if it has one.
Sourcefn get_partition_type(&self) -> PartitionType
fn get_partition_type(&self) -> PartitionType
Whether this partition is primary, logical, or extended.
This only applies to MBR partition tables. Partitions are always Primary
on GPT.
Sourcefn get_sector_end(&self) -> u64
fn get_sector_end(&self) -> u64
The sector where this partition ends on the parent block device.
Sourcefn get_sector_start(&self) -> u64
fn get_sector_start(&self) -> u64
The sector where this partition begins on the parent block device..
Provided Methods§
Sourcefn get_sectors(&self) -> u64
fn get_sectors(&self) -> u64
Returns the length of the partition in sectors.
Sourcefn is_esp_partition(&self) -> bool
fn is_esp_partition(&self) -> bool
True if the partition is an ESP partition.
Sourcefn is_linux_compatible(&self) -> bool
fn is_linux_compatible(&self) -> bool
True if the partition is compatible for Linux to be installed on it.
Sourcefn probe<T, F>(&self, func: F) -> T
fn probe<T, F>(&self, func: F) -> T
Mount the file system at a temporary directory, and allow the caller to scan it.
Sourcefn probe_os(&self) -> Option<OS>
fn probe_os(&self) -> Option<OS>
Detects if an OS is installed to this partition, and if so, what the OS is named.
Sourcefn sectors_differ_from<P: PartitionExt>(&self, other: &P) -> bool
fn sectors_differ_from<P: PartitionExt>(&self, other: &P) -> bool
True if the sectors in the compared partition differs from the source.
Sourcefn sector_lies_within(&self, sector: u64) -> bool
fn sector_lies_within(&self, sector: u64) -> bool
True if the given sector lies within this partition.
Sourcefn sectors_overlap(&self, start: u64, end: u64) -> bool
fn sectors_overlap(&self, start: u64, end: u64) -> bool
True if there is an overlap in sectors between both partitions.
Sourcefn sectors_used(&self) -> Result<u64>
fn sectors_used(&self) -> Result<u64>
Executes a given file system’s dump command to obtain the minimum shrink size
The return value is measured in sectors normalized to the logical sector size of the partition.
Returns io::ErrorKind::NotFound
if getting usage is not supported.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.