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

Used to determine what you want to refresh specifically on the Process 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::{ProcessExt, ProcessRefreshKind, System, SystemExt};

let mut system = System::new();

// We don't want to update the CPU information.
system.refresh_processes_specifics(ProcessRefreshKind::everything().without_cpu());

for (_, proc_) in system.processes() {
    // We use a `==` comparison on float only because we know it's set to 0 here.
    assert_eq!(proc_.cpu_usage(), 0.);
}

Implementations§

Creates a new ProcessRefreshKind with every refresh set to false.

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::new();

assert_eq!(r.cpu(), false);
assert_eq!(r.disk_usage(), false);

Creates a new ProcessRefreshKind with every refresh set to true.

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::everything();

assert_eq!(r.cpu(), true);
assert_eq!(r.disk_usage(), true);

Returns the value of the “cpu” refresh kind.

use sysinfo::ProcessRefreshKind;

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

let r = r.with_cpu();
assert_eq!(r.cpu(), true);

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

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

use sysinfo::ProcessRefreshKind;

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

let r = r.with_cpu();
assert_eq!(r.cpu(), true);

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

use sysinfo::ProcessRefreshKind;

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

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

Returns the value of the “disk_usage” refresh kind.

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::new();
assert_eq!(r.disk_usage(), false);

let r = r.with_disk_usage();
assert_eq!(r.disk_usage(), true);

let r = r.without_disk_usage();
assert_eq!(r.disk_usage(), false);

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

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::new();
assert_eq!(r.disk_usage(), false);

let r = r.with_disk_usage();
assert_eq!(r.disk_usage(), true);

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

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::everything();
assert_eq!(r.disk_usage(), true);

let r = r.without_disk_usage();
assert_eq!(r.disk_usage(), false);

Returns the value of the “user” refresh kind. This refresh is about user_id and group_id. Please note that it has an effect mostly on Windows as other platforms get this information alongside the Process information directly.

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::new();
assert_eq!(r.user(), false);

let r = r.with_user();
assert_eq!(r.user(), true);

let r = r.without_user();
assert_eq!(r.user(), false);

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

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::new();
assert_eq!(r.user(), false);

let r = r.with_user();
assert_eq!(r.user(), true);

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

use sysinfo::ProcessRefreshKind;

let r = ProcessRefreshKind::everything();
assert_eq!(r.user(), true);

let r = r.without_user();
assert_eq!(r.user(), 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 ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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.