pub struct StorageVolume {
pub description: String,
pub is_primary: bool,
pub is_removable: bool,
pub is_stable: bool,
pub is_emulated: bool,
pub is_readonly: bool,
pub is_available_for_app_storage: bool,
pub is_available_for_public_storage: bool,
pub id: StorageVolumeId,
}Fields§
§description: StringA user-visible description of the volume.
This can be determined by the manufacturer and is often localized according to the user’s language.
e.g.
Internal shared storageSDCARDSD cardVirtual SD card
is_primary: boolIndicates whether this is primary storage volume. A device always has one (and one only) primary storage volume.
is_removable: boolIndicates whether this is physically removable.
If false, this is device’s built-in storage.
is_stable: boolIndicates whether thit is stable part of the device.
For example, a device’s built-in storage and physical media slots under protective covers are considered stable, while USB flash drives connected to handheld devices are not.
is_emulated: boolIndicates whether this is backed by private user data partition, either internal storage or adopted storage.
On most recent devices, the primary storage volume will often have this set to true.
is_readonly: boolIndicates whether this is readonly storage volume.
e.g. SD card with readonly mode.
§Remark
As far as I understand, this should never be true
when either is_primary or is_emulated is true,
or when is_removable is false,
but it might not be the case due to any issues or rare cases.
is_available_for_app_storage: bool§is_available_for_public_storage: bool§id: StorageVolumeIdImplementations§
Source§impl StorageVolume
impl StorageVolume
Sourcepub fn is_sd_card_like(&self) -> bool
pub fn is_sd_card_like(&self) -> bool
Returns true if this volume is likely a SD-card–type storage.
This is a heuristic classification based on the following properties:
is_removable == trueis_stable == true
Such volumes are typically removable media that are considered a stable part of the device.
Sourcepub fn is_usb_drive_like(&self) -> bool
pub fn is_usb_drive_like(&self) -> bool
Returns true if this volume is likely a USB-drive–type storage.
This is a heuristic classification based on the following properties:
is_removable == trueis_stable == false
Such volumes are typically removable media that are not considered a stable part of the device.
Trait Implementations§
Source§impl Clone for StorageVolume
impl Clone for StorageVolume
Source§fn clone(&self) -> StorageVolume
fn clone(&self) -> StorageVolume
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more