Skip to main content

DeviceInfo

Struct DeviceInfo 

Source
pub struct DeviceInfo {
    pub node: String,
    pub name: String,
    pub total_bytes: u64,
    pub used_bytes: Option<u64>,
    pub removable: bool,
    pub ejectable: bool,
    pub internal: bool,
    pub boot: bool,
    pub mounted: bool,
}
Expand description

What the OS reports about a candidate device, authored by Formatter::probe — never from user input. Carries no secret material (I12).

Fields§

§node: String

The device node as the OS addresses it (e.g. /dev/disk4).

§name: String

Human label (volume / media name), best-effort; may be empty.

§total_bytes: u64

Total capacity in bytes (0 if the OS did not report it).

§used_bytes: Option<u64>

Bytes in use across mounted volumes, if the OS reported it.

§removable: bool

The device’s media is removable from its mechanism (SD card, optical), as opposed to fixed flash/SSD. Informational only — it is NOT the erase safety predicate (a USB SSD reports Fixed yet is a perfectly safe, intended target). The rail keys on Self::ejectable + external instead.

§ejectable: bool

The device can be ejected from the running system (external bus). Internal disks are not ejectable. This — together with not-internal and not-boot — is the actual erase-safety predicate the rail enforces.

§internal: bool

The device is internal/onboard — the opposite of an external stick.

§boot: bool

The device backs the current boot/system volume.

§mounted: bool

At least one volume on the device is currently mounted.

Implementations§

Source§

impl DeviceInfo

Source

pub fn human_size(&self) -> String

A human-readable capacity for the I16 headline (never a value).

Source

pub fn non_empty(&self) -> bool

Whether the device appears to hold data — used to decide whether the confirmation headline must carry a content warning.

Trait Implementations§

Source§

impl Clone for DeviceInfo

Source§

fn clone(&self) -> DeviceInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DeviceInfo

Source§

impl PartialEq for DeviceInfo

Source§

fn eq(&self, other: &DeviceInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DeviceInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V