pub struct DriveInfo {
pub name: String,
pub mount_point: String,
pub size_gb: f64,
pub device_path: String,
pub is_system: bool,
pub is_read_only: bool,
pub disabled: bool,
pub usb_info: Option<UsbInfo>,
}Expand description
Information about a storage drive visible to the system.
Fields§
§name: StringHuman-readable display name (model, vendor, or device node).
mount_point: StringMount point of the drive or one of its partitions. Falls back to the device path when not mounted.
size_gb: f64Drive capacity in gigabytes.
device_path: StringKernel block device path, e.g. /dev/sdb.
is_system: booltrue when the drive (or one of its partitions) is mounted at a
critical system location (/, /boot, /usr, …).
is_read_only: booltrue when the kernel reports the device as read-only (/sys/block/X/ro == 1).
disabled: booltrue when a constraint check determined this drive must not be
selected (too small, read-only, source drive, …).
usb_info: Option<UsbInfo>USB descriptor metadata — Some for USB drives, None for internal
SATA / NVMe / eMMC devices.
Implementations§
Source§impl DriveInfo
impl DriveInfo
Sourcepub fn new(
name: String,
mount_point: String,
size_gb: f64,
device_path: String,
) -> DriveInfo
pub fn new( name: String, mount_point: String, size_gb: f64, device_path: String, ) -> DriveInfo
Create a DriveInfo with the four essential fields.
is_system, is_read_only, disabled, and usb_info all default
to false / None.
Sourcepub fn with_constraints(
name: String,
mount_point: String,
size_gb: f64,
device_path: String,
is_system: bool,
is_read_only: bool,
) -> DriveInfo
pub fn with_constraints( name: String, mount_point: String, size_gb: f64, device_path: String, is_system: bool, is_read_only: bool, ) -> DriveInfo
Create a DriveInfo with constraint flags set explicitly.
disabled defaults to false; usb_info defaults to None.
Sourcepub fn with_usb_info(self, info: UsbInfo) -> DriveInfo
pub fn with_usb_info(self, info: UsbInfo) -> DriveInfo
Attach USB descriptor metadata to this drive and return self.
Intended for use in a builder chain:
let drive = DriveInfo::new(
"SanDisk Ultra".into(), "/dev/sdb".into(), 32.0, "/dev/sdb".into(),
)
.with_usb_info(UsbInfo {
vendor_id: 0x0781,
product_id: 0x5581,
manufacturer: Some("SanDisk".into()),
product: Some("Ultra".into()),
serial: Some("AA01234567890".into()),
speed: Some("SuperSpeed (5 Gbps)".into()),
});
assert!(drive.usb_info.is_some());Trait Implementations§
Auto Trait Implementations§
impl Freeze for DriveInfo
impl RefUnwindSafe for DriveInfo
impl Send for DriveInfo
impl Sync for DriveInfo
impl Unpin for DriveInfo
impl UnsafeUnpin for DriveInfo
impl UnwindSafe for DriveInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.