Struct fstab_generate::PartitionID
source · pub struct PartitionID {
pub variant: PartitionSource,
pub id: String,
}
Expand description
Describes a partition identity.
A device path may be recovered from this.
Notes
This is a struct instead of an enum to make access to the id
string
easier for situations where the variant does not need to be checked.
Fields
variant: PartitionSource
id: String
Implementations
sourceimpl PartitionID
impl PartitionID
sourcepub fn new(variant: PartitionSource, id: String) -> PartitionID
pub fn new(variant: PartitionSource, id: String) -> PartitionID
Construct a new PartitionID
as the given source.
sourcepub fn new_id(id: String) -> PartitionID
pub fn new_id(id: String) -> PartitionID
Construct a new PartitionID
as a ID
source.
sourcepub fn new_label(id: String) -> PartitionID
pub fn new_label(id: String) -> PartitionID
Construct a new PartitionID
as a Label
source.
sourcepub fn new_uuid(id: String) -> PartitionID
pub fn new_uuid(id: String) -> PartitionID
Construct a new PartitionID
as a UUID
source.
sourcepub fn new_partlabel(id: String) -> PartitionID
pub fn new_partlabel(id: String) -> PartitionID
Construct a new PartitionID
as a PartLabel
source.
sourcepub fn new_partuuid(id: String) -> PartitionID
pub fn new_partuuid(id: String) -> PartitionID
Construct a new PartitionID
as a PartUUID
source.
sourcepub fn new_path(id: String) -> PartitionID
pub fn new_path(id: String) -> PartitionID
Construct a new PartitionID
as a Path
source.
sourcepub fn get_device_path(&self) -> Option<PathBuf>
pub fn get_device_path(&self) -> Option<PathBuf>
Find the device path of this ID.
sourcepub fn get_source<P>(variant: PartitionSource, path: P) -> Option<PartitionID>where
P: AsRef<Path>,
pub fn get_source<P>(variant: PartitionSource, path: P) -> Option<PartitionID>where
P: AsRef<Path>,
Find the given source ID of the device at the given path.
sourcepub fn get_uuid<P>(path: P) -> Option<PartitionID>where
P: AsRef<Path>,
pub fn get_uuid<P>(path: P) -> Option<PartitionID>where
P: AsRef<Path>,
Find the UUID of the device at the given path.
sourcepub fn get_partuuid<P>(path: P) -> Option<PartitionID>where
P: AsRef<Path>,
pub fn get_partuuid<P>(path: P) -> Option<PartitionID>where
P: AsRef<Path>,
Find the PARTUUID of the device at the given path.
sourcepub fn from_disk_by_path<S>(path: S) -> Result<PartitionID, Error>where
S: AsRef<str>,
pub fn from_disk_by_path<S>(path: S) -> Result<PartitionID, Error>where
S: AsRef<str>,
Fetch a partition ID by a /dev/disk/by-
path.
Trait Implementations
sourceimpl Clone for PartitionID
impl Clone for PartitionID
sourcefn clone(&self) -> PartitionID
fn clone(&self) -> PartitionID
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more