Trait sysinfo::DiskExt[][src]

pub trait DiskExt: Debug {
    fn get_type(&self) -> DiskType;
fn get_name(&self) -> &OsStr;
fn get_file_system(&self) -> &[u8];
fn get_mount_point(&self) -> &Path;
fn get_total_space(&self) -> u64;
fn get_available_space(&self) -> u64;
fn refresh(&mut self) -> bool; }

Contains all the methods of the Disk struct.

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{:?}: {:?}", disk.get_name(), disk.get_type());
}

Required methods

fn get_type(&self) -> DiskType[src]

Returns the disk type.

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{:?}", disk.get_type());
}

fn get_name(&self) -> &OsStr[src]

Returns the disk name.

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{:?}", disk.get_name());
}

fn get_file_system(&self) -> &[u8][src]

Returns the file system used on this disk (so for example: EXT4, NTFS, etc…).

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{:?}", disk.get_file_system());
}

fn get_mount_point(&self) -> &Path[src]

Returns the mount point of the disk (/ for example).

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{:?}", disk.get_mount_point());
}

fn get_total_space(&self) -> u64[src]

Returns the total disk size, in bytes.

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{}", disk.get_total_space());
}

fn get_available_space(&self) -> u64[src]

Returns the available disk size, in bytes.

use sysinfo::{DiskExt, System, SystemExt};

let s = System::new();
for disk in s.get_disks() {
    println!("{}", disk.get_available_space());
}

fn refresh(&mut self) -> bool[src]

Updates the disk’ information.

use sysinfo::{DiskExt, System, SystemExt};

let mut s = System::new_all();
for disk in s.get_disks_mut() {
    disk.refresh();
}
Loading content...

Implementors

impl DiskExt for Disk[src]

Loading content...