Struct partition_identity::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) -> Self
pub fn new(variant: PartitionSource, id: String) -> Self
Construct a new PartitionID
as the given source.
sourcepub fn new_partlabel(id: String) -> Self
pub fn new_partlabel(id: String) -> Self
Construct a new PartitionID
as a PartLabel
source.
sourcepub fn new_partuuid(id: String) -> Self
pub fn new_partuuid(id: String) -> Self
Construct a new PartitionID
as a PartUUID
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: AsRef<Path>>(
variant: PartitionSource,
path: P
) -> Option<Self>
pub fn get_source<P: AsRef<Path>>(
variant: PartitionSource,
path: P
) -> Option<Self>
Find the given source ID of the device at the given path.
sourcepub fn get_uuid<P: AsRef<Path>>(path: P) -> Option<Self>
pub fn get_uuid<P: AsRef<Path>>(path: P) -> Option<Self>
Find the UUID of the device at the given path.
sourcepub fn get_partuuid<P: AsRef<Path>>(path: P) -> Option<Self>
pub fn get_partuuid<P: AsRef<Path>>(path: P) -> Option<Self>
Find the PARTUUID of the device at the given path.
Trait Implementations
sourceimpl Clone for PartitionID
impl Clone for PartitionID
sourcefn clone(&self) -> PartitionID
fn clone(&self) -> PartitionID
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PartitionID
impl Debug for PartitionID
sourceimpl Display for PartitionID
impl Display for PartitionID
sourceimpl FromStr for PartitionID
impl FromStr for PartitionID
sourceimpl Hash for PartitionID
impl Hash for PartitionID
sourceimpl PartialEq<PartitionID> for PartitionID
impl PartialEq<PartitionID> for PartitionID
sourcefn eq(&self, other: &PartitionID) -> bool
fn eq(&self, other: &PartitionID) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PartitionID) -> bool
fn ne(&self, other: &PartitionID) -> bool
This method tests for !=
.
impl Eq for PartitionID
impl StructuralEq for PartitionID
impl StructuralPartialEq for PartitionID
Auto Trait Implementations
impl RefUnwindSafe for PartitionID
impl Send for PartitionID
impl Sync for PartitionID
impl Unpin for PartitionID
impl UnwindSafe for PartitionID
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more