Struct ProcessRefreshKind
pub struct ProcessRefreshKind { /* private fields */ }
dep_sysinfo
only.Expand description
Used to determine what you want to refresh specifically on the Process
type.
When all refresh are ruled out, a Process
will still retrieve the following information:
- Process ID (
Pid
) - Parent process ID (on Windows it never changes though)
- Process name
- Start time
⚠️ 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::{ProcessesToUpdate, ProcessRefreshKind, System};
let mut system = System::new();
// We don't want to update the CPU information.
system.refresh_processes_specifics(
ProcessesToUpdate::All,
true,
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§
§impl ProcessRefreshKind
impl ProcessRefreshKind
pub fn nothing() -> ProcessRefreshKind
pub fn nothing() -> ProcessRefreshKind
Creates a new ProcessRefreshKind
with every refresh set to false
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.cpu(), false);
assert_eq!(r.user(), UpdateKind::Never);
pub fn everything() -> ProcessRefreshKind
pub fn everything() -> ProcessRefreshKind
Creates a new ProcessRefreshKind
with every refresh set to true
or
UpdateKind::OnlyIfNotSet
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.cpu(), true);
assert_eq!(r.user(), UpdateKind::OnlyIfNotSet);
pub fn cpu(&self) -> bool
pub fn cpu(&self) -> bool
Returns the value of the “cpu” refresh kind.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::nothing();
let r = r.with_cpu();
assert_eq!(r.cpu(), true);
let r = r.without_cpu();
assert_eq!(r.cpu(), false);
pub fn with_cpu(self) -> ProcessRefreshKind
pub fn with_cpu(self) -> ProcessRefreshKind
Sets the value of the “cpu” refresh kind to true
.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::nothing();
let r = r.with_cpu();
assert_eq!(r.cpu(), true);
pub fn without_cpu(self) -> ProcessRefreshKind
pub fn without_cpu(self) -> ProcessRefreshKind
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);
pub fn disk_usage(&self) -> bool
pub fn disk_usage(&self) -> bool
Returns the value of the “disk_usage” refresh kind.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::nothing();
let r = r.with_disk_usage();
assert_eq!(r.disk_usage(), true);
let r = r.without_disk_usage();
assert_eq!(r.disk_usage(), false);
pub fn with_disk_usage(self) -> ProcessRefreshKind
pub fn with_disk_usage(self) -> ProcessRefreshKind
Sets the value of the “disk_usage” refresh kind to true
.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::nothing();
let r = r.with_disk_usage();
assert_eq!(r.disk_usage(), true);
pub fn without_disk_usage(self) -> ProcessRefreshKind
pub fn without_disk_usage(self) -> ProcessRefreshKind
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);
pub fn user(&self) -> UpdateKind
pub fn user(&self) -> UpdateKind
Returns the value of the “user” refresh kind. It will retrieve the following information:
- user ID
- user effective ID (if available on the platform)
- user group ID (if available on the platform)
- user effective ID (if available on the platform)
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.user(), UpdateKind::Never);
let r = r.with_user(UpdateKind::OnlyIfNotSet);
assert_eq!(r.user(), UpdateKind::OnlyIfNotSet);
let r = r.without_user();
assert_eq!(r.user(), UpdateKind::Never);
pub fn with_user(self, kind: UpdateKind) -> ProcessRefreshKind
pub fn with_user(self, kind: UpdateKind) -> ProcessRefreshKind
Sets the value of the “user” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.user(), UpdateKind::Never);
let r = r.with_user(UpdateKind::OnlyIfNotSet);
assert_eq!(r.user(), UpdateKind::OnlyIfNotSet);
pub fn without_user(self) -> ProcessRefreshKind
pub fn without_user(self) -> ProcessRefreshKind
Sets the value of the “user” refresh kind to UpdateKind::Never
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.user(), UpdateKind::OnlyIfNotSet);
let r = r.without_user();
assert_eq!(r.user(), UpdateKind::Never);
pub fn memory(&self) -> bool
pub fn memory(&self) -> bool
Returns the value of the “memory” refresh kind.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::nothing();
let r = r.with_memory();
assert_eq!(r.memory(), true);
let r = r.without_memory();
assert_eq!(r.memory(), false);
pub fn with_memory(self) -> ProcessRefreshKind
pub fn with_memory(self) -> ProcessRefreshKind
Sets the value of the “memory” refresh kind to true
.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::nothing();
let r = r.with_memory();
assert_eq!(r.memory(), true);
pub fn without_memory(self) -> ProcessRefreshKind
pub fn without_memory(self) -> ProcessRefreshKind
Sets the value of the “memory” refresh kind to false
.
use sysinfo::ProcessRefreshKind;
let r = ProcessRefreshKind::everything();
assert_eq!(r.memory(), true);
let r = r.without_memory();
assert_eq!(r.memory(), false);
pub fn cwd(&self) -> UpdateKind
pub fn cwd(&self) -> UpdateKind
Returns the value of the “cwd” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.cwd(), UpdateKind::Never);
let r = r.with_cwd(UpdateKind::OnlyIfNotSet);
assert_eq!(r.cwd(), UpdateKind::OnlyIfNotSet);
let r = r.without_cwd();
assert_eq!(r.cwd(), UpdateKind::Never);
pub fn with_cwd(self, kind: UpdateKind) -> ProcessRefreshKind
pub fn with_cwd(self, kind: UpdateKind) -> ProcessRefreshKind
Sets the value of the “cwd” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.cwd(), UpdateKind::Never);
let r = r.with_cwd(UpdateKind::OnlyIfNotSet);
assert_eq!(r.cwd(), UpdateKind::OnlyIfNotSet);
pub fn without_cwd(self) -> ProcessRefreshKind
pub fn without_cwd(self) -> ProcessRefreshKind
Sets the value of the “cwd” refresh kind to UpdateKind::Never
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.cwd(), UpdateKind::OnlyIfNotSet);
let r = r.without_cwd();
assert_eq!(r.cwd(), UpdateKind::Never);
pub fn root(&self) -> UpdateKind
pub fn root(&self) -> UpdateKind
Returns the value of the “root” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.root(), UpdateKind::Never);
let r = r.with_root(UpdateKind::OnlyIfNotSet);
assert_eq!(r.root(), UpdateKind::OnlyIfNotSet);
let r = r.without_root();
assert_eq!(r.root(), UpdateKind::Never);
pub fn with_root(self, kind: UpdateKind) -> ProcessRefreshKind
pub fn with_root(self, kind: UpdateKind) -> ProcessRefreshKind
Sets the value of the “root” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.root(), UpdateKind::Never);
let r = r.with_root(UpdateKind::OnlyIfNotSet);
assert_eq!(r.root(), UpdateKind::OnlyIfNotSet);
pub fn without_root(self) -> ProcessRefreshKind
pub fn without_root(self) -> ProcessRefreshKind
Sets the value of the “root” refresh kind to UpdateKind::Never
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.root(), UpdateKind::OnlyIfNotSet);
let r = r.without_root();
assert_eq!(r.root(), UpdateKind::Never);
pub fn environ(&self) -> UpdateKind
pub fn environ(&self) -> UpdateKind
Returns the value of the “environ” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.environ(), UpdateKind::Never);
let r = r.with_environ(UpdateKind::OnlyIfNotSet);
assert_eq!(r.environ(), UpdateKind::OnlyIfNotSet);
let r = r.without_environ();
assert_eq!(r.environ(), UpdateKind::Never);
pub fn with_environ(self, kind: UpdateKind) -> ProcessRefreshKind
pub fn with_environ(self, kind: UpdateKind) -> ProcessRefreshKind
Sets the value of the “environ” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.environ(), UpdateKind::Never);
let r = r.with_environ(UpdateKind::OnlyIfNotSet);
assert_eq!(r.environ(), UpdateKind::OnlyIfNotSet);
pub fn without_environ(self) -> ProcessRefreshKind
pub fn without_environ(self) -> ProcessRefreshKind
Sets the value of the “environ” refresh kind to UpdateKind::Never
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.environ(), UpdateKind::OnlyIfNotSet);
let r = r.without_environ();
assert_eq!(r.environ(), UpdateKind::Never);
pub fn cmd(&self) -> UpdateKind
pub fn cmd(&self) -> UpdateKind
Returns the value of the “cmd” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.cmd(), UpdateKind::Never);
let r = r.with_cmd(UpdateKind::OnlyIfNotSet);
assert_eq!(r.cmd(), UpdateKind::OnlyIfNotSet);
let r = r.without_cmd();
assert_eq!(r.cmd(), UpdateKind::Never);
pub fn with_cmd(self, kind: UpdateKind) -> ProcessRefreshKind
pub fn with_cmd(self, kind: UpdateKind) -> ProcessRefreshKind
Sets the value of the “cmd” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.cmd(), UpdateKind::Never);
let r = r.with_cmd(UpdateKind::OnlyIfNotSet);
assert_eq!(r.cmd(), UpdateKind::OnlyIfNotSet);
pub fn without_cmd(self) -> ProcessRefreshKind
pub fn without_cmd(self) -> ProcessRefreshKind
Sets the value of the “cmd” refresh kind to UpdateKind::Never
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.cmd(), UpdateKind::OnlyIfNotSet);
let r = r.without_cmd();
assert_eq!(r.cmd(), UpdateKind::Never);
pub fn exe(&self) -> UpdateKind
pub fn exe(&self) -> UpdateKind
Returns the value of the “exe” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.exe(), UpdateKind::Never);
let r = r.with_exe(UpdateKind::OnlyIfNotSet);
assert_eq!(r.exe(), UpdateKind::OnlyIfNotSet);
let r = r.without_exe();
assert_eq!(r.exe(), UpdateKind::Never);
pub fn with_exe(self, kind: UpdateKind) -> ProcessRefreshKind
pub fn with_exe(self, kind: UpdateKind) -> ProcessRefreshKind
Sets the value of the “exe” refresh kind.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::nothing();
assert_eq!(r.exe(), UpdateKind::Never);
let r = r.with_exe(UpdateKind::OnlyIfNotSet);
assert_eq!(r.exe(), UpdateKind::OnlyIfNotSet);
pub fn without_exe(self) -> ProcessRefreshKind
pub fn without_exe(self) -> ProcessRefreshKind
Sets the value of the “exe” refresh kind to UpdateKind::Never
.
use sysinfo::{ProcessRefreshKind, UpdateKind};
let r = ProcessRefreshKind::everything();
assert_eq!(r.exe(), UpdateKind::OnlyIfNotSet);
let r = r.without_exe();
assert_eq!(r.exe(), UpdateKind::Never);
Trait Implementations§
§impl Clone for ProcessRefreshKind
impl Clone for ProcessRefreshKind
§fn clone(&self) -> ProcessRefreshKind
fn clone(&self) -> ProcessRefreshKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for ProcessRefreshKind
impl Debug for ProcessRefreshKind
§impl Default for ProcessRefreshKind
impl Default for ProcessRefreshKind
§fn default() -> ProcessRefreshKind
fn default() -> ProcessRefreshKind
§impl PartialEq for ProcessRefreshKind
impl PartialEq for ProcessRefreshKind
impl Copy for ProcessRefreshKind
impl Eq for ProcessRefreshKind
impl StructuralPartialEq for ProcessRefreshKind
Auto Trait Implementations§
impl Freeze for ProcessRefreshKind
impl RefUnwindSafe for ProcessRefreshKind
impl Send for ProcessRefreshKind
impl Sync for ProcessRefreshKind
impl Unpin for ProcessRefreshKind
impl UnwindSafe for ProcessRefreshKind
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> usize ⓘ
Source§fn mem_size_of_val(&self) -> usize ⓘ
fn mem_size_of_val(&self) -> usize ⓘ
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.