DiskRefreshKind

Struct DiskRefreshKind 

Source
pub struct DiskRefreshKind { /* private fields */ }
Expand description

Used to determine what you want to refresh specifically on the Disk type.

use sysinfo::{Disks, DiskRefreshKind};

let mut disks = Disks::new_with_refreshed_list_specifics(DiskRefreshKind::everything());

for disk in disks.list() {
    assert!(disk.total_space() != 0);
}

Implementations§

Source§

impl DiskRefreshKind

Source

pub fn nothing() -> Self

Creates a new DiskRefreshKind with every refresh set to false.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

assert_eq!(r.kind(), false);
assert_eq!(r.storage(), false);
assert_eq!(r.io_usage(), false);
Source

pub fn everything() -> Self

Creates a new DiskRefreshKind with every refresh set to true.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::everything();

assert_eq!(r.kind(), true);
assert_eq!(r.storage(), true);
assert_eq!(r.io_usage(), true);
Source

pub fn kind(&self) -> bool

Returns the value of the “kind” refresh kind.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

let r = r.with_kind();
assert_eq!(r.kind(), true);

let r = r.without_kind();
assert_eq!(r.kind(), false);
Source

pub fn with_kind(self) -> Self

Sets the value of the “kind” refresh kind to true.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

let r = r.with_kind();
assert_eq!(r.kind(), true);
Source

pub fn without_kind(self) -> Self

Sets the value of the “kind” refresh kind to false.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::everything();
assert_eq!(r.kind(), true);

let r = r.without_kind();
assert_eq!(r.kind(), false);
Source

pub fn storage(&self) -> bool

Returns the value of the “storage” refresh kind.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

let r = r.with_storage();
assert_eq!(r.storage(), true);

let r = r.without_storage();
assert_eq!(r.storage(), false);
Source

pub fn with_storage(self) -> Self

Sets the value of the “storage” refresh kind to true.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

let r = r.with_storage();
assert_eq!(r.storage(), true);
Source

pub fn without_storage(self) -> Self

Sets the value of the “storage” refresh kind to false.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::everything();
assert_eq!(r.storage(), true);

let r = r.without_storage();
assert_eq!(r.storage(), false);
Source

pub fn io_usage(&self) -> bool

Returns the value of the “io_usage” refresh kind.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

let r = r.with_io_usage();
assert_eq!(r.io_usage(), true);

let r = r.without_io_usage();
assert_eq!(r.io_usage(), false);
Source

pub fn with_io_usage(self) -> Self

Sets the value of the “io_usage” refresh kind to true.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::nothing();

let r = r.with_io_usage();
assert_eq!(r.io_usage(), true);
Source

pub fn without_io_usage(self) -> Self

Sets the value of the “io_usage” refresh kind to false.

use sysinfo::DiskRefreshKind;

let r = DiskRefreshKind::everything();
assert_eq!(r.io_usage(), true);

let r = r.without_io_usage();
assert_eq!(r.io_usage(), false);

Trait Implementations§

Source§

impl Clone for DiskRefreshKind

Source§

fn clone(&self) -> DiskRefreshKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DiskRefreshKind

Source§

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

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

impl Default for DiskRefreshKind

Source§

fn default() -> DiskRefreshKind

Returns the “default value” for a type. Read more
Source§

impl Copy for DiskRefreshKind

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> 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<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> 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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 3 bytes