pub struct Disk { /* private fields */ }Expand description
Struct containing a disk information.
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("{:?}: {:?}", disk.name(), disk.kind());
}Implementations§
source§impl Disk
impl Disk
sourcepub fn kind(&self) -> DiskKind
pub fn kind(&self) -> DiskKind
Returns the kind of disk.
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("[{:?}] {:?}", disk.name(), disk.kind());
}sourcepub fn name(&self) -> &OsStr
pub fn name(&self) -> &OsStr
Returns the disk name.
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("{:?}", disk.name());
}sourcepub fn file_system(&self) -> &OsStr
pub fn file_system(&self) -> &OsStr
Returns the file system used on this disk (so for example: EXT4, NTFS, etc…).
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("[{:?}] {:?}", disk.name(), disk.file_system());
}sourcepub fn mount_point(&self) -> &Path
pub fn mount_point(&self) -> &Path
Returns the mount point of the disk (/ for example).
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("[{:?}] {:?}", disk.name(), disk.mount_point());
}sourcepub fn total_space(&self) -> u64
pub fn total_space(&self) -> u64
Returns the total disk size, in bytes.
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("[{:?}] {}B", disk.name(), disk.total_space());
}sourcepub fn available_space(&self) -> u64
pub fn available_space(&self) -> u64
Returns the available disk size, in bytes.
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("[{:?}] {}B", disk.name(), disk.available_space());
}sourcepub fn is_removable(&self) -> bool
pub fn is_removable(&self) -> bool
Returns true if the disk is removable.
use sysinfo::Disks;
let disks = Disks::new_with_refreshed_list();
for disk in disks.list() {
println!("[{:?}] {}", disk.name(), disk.is_removable());
}Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Disk
impl Send for Disk
impl Sync for Disk
impl Unpin for Disk
impl UnwindSafe for Disk
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more