pub struct RefreshKind { /* private fields */ }
Expand description

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

⚠️ Just like all other refresh types, ruling out a refresh doesn’t assure you that the information won’t be retrieved if the information is accessible without needing extra computation.

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

// We want everything except disks.
let mut system = System::new_with_specifics(RefreshKind::everything().without_disks_list());

assert_eq!(system.disks().len(), 0);
assert!(system.processes().len() > 0);

Implementations

Creates a new RefreshKind with every refresh set to false/None.

use sysinfo::RefreshKind;

let r = RefreshKind::new();

assert_eq!(r.networks(), false);
assert_eq!(r.networks_list(), false);
assert_eq!(r.processes().is_some(), false);
assert_eq!(r.disks_list(), false);
assert_eq!(r.disks(), false);
assert_eq!(r.memory(), false);
assert_eq!(r.cpu().is_some(), false);
assert_eq!(r.components(), false);
assert_eq!(r.components_list(), false);
assert_eq!(r.users_list(), false);

Creates a new RefreshKind with every refresh set to true/Some(...).

use sysinfo::RefreshKind;

let r = RefreshKind::everything();

assert_eq!(r.networks(), true);
assert_eq!(r.networks_list(), true);
assert_eq!(r.processes().is_some(), true);
assert_eq!(r.disks_list(), true);
assert_eq!(r.disks(), true);
assert_eq!(r.memory(), true);
assert_eq!(r.cpu().is_some(), true);
assert_eq!(r.components(), true);
assert_eq!(r.components_list(), true);
assert_eq!(r.users_list(), true);

Returns the value of the “processes” refresh kind.

use sysinfo::{RefreshKind, ProcessRefreshKind};

let r = RefreshKind::new();
assert_eq!(r.processes().is_some(), false);

let r = r.with_processes(ProcessRefreshKind::everything());
assert_eq!(r.processes().is_some(), true);

let r = r.without_processes();
assert_eq!(r.processes().is_some(), false);

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

use sysinfo::{RefreshKind, ProcessRefreshKind};

let r = RefreshKind::new();
assert_eq!(r.processes().is_some(), false);

let r = r.with_processes(ProcessRefreshKind::everything());
assert_eq!(r.processes().is_some(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.processes().is_some(), true);

let r = r.without_processes();
assert_eq!(r.processes().is_some(), false);

Returns the value of the “networks” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.networks(), false);

let r = r.with_networks();
assert_eq!(r.networks(), true);

let r = r.without_networks();
assert_eq!(r.networks(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.networks(), false);

let r = r.with_networks();
assert_eq!(r.networks(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.networks(), true);

let r = r.without_networks();
assert_eq!(r.networks(), false);

Returns the value of the “networks_list” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.networks_list(), false);

let r = r.with_networks_list();
assert_eq!(r.networks_list(), true);

let r = r.without_networks_list();
assert_eq!(r.networks_list(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.networks_list(), false);

let r = r.with_networks_list();
assert_eq!(r.networks_list(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.networks_list(), true);

let r = r.without_networks_list();
assert_eq!(r.networks_list(), false);

Returns the value of the “disks” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.disks(), false);

let r = r.with_disks();
assert_eq!(r.disks(), true);

let r = r.without_disks();
assert_eq!(r.disks(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.disks(), false);

let r = r.with_disks();
assert_eq!(r.disks(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.disks(), true);

let r = r.without_disks();
assert_eq!(r.disks(), false);

Returns the value of the “disks_list” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.disks_list(), false);

let r = r.with_disks_list();
assert_eq!(r.disks_list(), true);

let r = r.without_disks_list();
assert_eq!(r.disks_list(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.disks_list(), false);

let r = r.with_disks_list();
assert_eq!(r.disks_list(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.disks_list(), true);

let r = r.without_disks_list();
assert_eq!(r.disks_list(), false);

Returns the value of the “memory” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.memory(), false);

let r = r.with_memory();
assert_eq!(r.memory(), true);

let r = r.without_memory();
assert_eq!(r.memory(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.memory(), false);

let r = r.with_memory();
assert_eq!(r.memory(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.memory(), true);

let r = r.without_memory();
assert_eq!(r.memory(), false);

Returns the value of the “cpu” refresh kind.

use sysinfo::{RefreshKind, CpuRefreshKind};

let r = RefreshKind::new();
assert_eq!(r.cpu().is_some(), false);

let r = r.with_cpu(CpuRefreshKind::everything());
assert_eq!(r.cpu().is_some(), true);

let r = r.without_cpu();
assert_eq!(r.cpu().is_some(), false);

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

use sysinfo::{RefreshKind, CpuRefreshKind};

let r = RefreshKind::new();
assert_eq!(r.cpu().is_some(), false);

let r = r.with_cpu(CpuRefreshKind::everything());
assert_eq!(r.cpu().is_some(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.cpu().is_some(), true);

let r = r.without_cpu();
assert_eq!(r.cpu().is_some(), false);

Returns the value of the “components” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.components(), false);

let r = r.with_components();
assert_eq!(r.components(), true);

let r = r.without_components();
assert_eq!(r.components(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.components(), false);

let r = r.with_components();
assert_eq!(r.components(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.components(), true);

let r = r.without_components();
assert_eq!(r.components(), false);

Returns the value of the “components_list” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.components_list(), false);

let r = r.with_components_list();
assert_eq!(r.components_list(), true);

let r = r.without_components_list();
assert_eq!(r.components_list(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.components_list(), false);

let r = r.with_components_list();
assert_eq!(r.components_list(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.components_list(), true);

let r = r.without_components_list();
assert_eq!(r.components_list(), false);

Returns the value of the “users_list” refresh kind.

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.users_list(), false);

let r = r.with_users_list();
assert_eq!(r.users_list(), true);

let r = r.without_users_list();
assert_eq!(r.users_list(), false);

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

use sysinfo::RefreshKind;

let r = RefreshKind::new();
assert_eq!(r.users_list(), false);

let r = r.with_users_list();
assert_eq!(r.users_list(), true);

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

use sysinfo::RefreshKind;

let r = RefreshKind::everything();
assert_eq!(r.users_list(), true);

let r = r.without_users_list();
assert_eq!(r.users_list(), false);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.