pub struct System { /* private fields */ }
Expand description
Structs containing system’s information.
Trait Implementations
sourceimpl SystemExt for System
impl SystemExt for System
sourceconst IS_SUPPORTED: bool = true
const IS_SUPPORTED: bool = true
Returns
true
if this OS is supported. Please refer to the
crate-level documentation to get the list of supported OSes. Read moresourceconst SUPPORTED_SIGNALS: &'static [Signal] = _
const SUPPORTED_SIGNALS: &'static [Signal] = _
Returns the list of the supported signals on this system (used by
ProcessExt::kill_with
). Read moresourcefn new_with_specifics(refreshes: RefreshKind) -> System
fn new_with_specifics(refreshes: RefreshKind) -> System
Creates a new
System
instance and refresh the data corresponding to the
given RefreshKind
. Read moresourcefn refresh_cpu_specifics(&mut self, refresh_kind: CpuRefreshKind)
fn refresh_cpu_specifics(&mut self, refresh_kind: CpuRefreshKind)
Refreshes CPUs specific information. Read more
sourcefn refresh_memory(&mut self)
fn refresh_memory(&mut self)
Refreshes RAM and SWAP usage. Read more
sourcefn refresh_components_list(&mut self)
fn refresh_components_list(&mut self)
Refreshes components list. Read more
sourcefn refresh_process_specifics(
&mut self,
pid: Pid,
refresh_kind: ProcessRefreshKind
) -> bool
fn refresh_process_specifics(
&mut self,
pid: Pid,
refresh_kind: ProcessRefreshKind
) -> bool
Refreshes only the process corresponding to
pid
. Returns false
if the process doesn’t
exist (it will NOT be removed from the processes if it doesn’t exist anymore). If it
isn’t listed yet, it’ll be added. Read moresourcefn refresh_processes_specifics(&mut self, refresh_kind: ProcessRefreshKind)
fn refresh_processes_specifics(&mut self, refresh_kind: ProcessRefreshKind)
Gets all processes and updates the specified information. Read more
sourcefn refresh_disks_list(&mut self)
fn refresh_disks_list(&mut self)
The disk list will be emptied then completely recomputed. Read more
sourcefn refresh_users_list(&mut self)
fn refresh_users_list(&mut self)
Refreshes users list. Read more
sourcefn process(&self, pid: Pid) -> Option<&Process>
fn process(&self, pid: Pid) -> Option<&Process>
Returns the process corresponding to the given pid or
None
if no such process exists. Read moresourcefn global_cpu_info(&self) -> &Cpu
fn global_cpu_info(&self) -> &Cpu
Returns “global” cpus information (aka the addition of all the CPUs). Read more
sourcefn physical_core_count(&self) -> Option<usize>
fn physical_core_count(&self) -> Option<usize>
Returns the number of physical cores on the CPU or
None
if it couldn’t get it. Read moresourcefn total_memory(&self) -> u64
fn total_memory(&self) -> u64
Returns the RAM size in bytes. Read more
sourcefn free_memory(&self) -> u64
fn free_memory(&self) -> u64
Returns the amount of free RAM in bytes. Read more
sourcefn available_memory(&self) -> u64
fn available_memory(&self) -> u64
Returns the amount of available RAM in bytes. Read more
sourcefn used_memory(&self) -> u64
fn used_memory(&self) -> u64
Returns the amount of used RAM in bytes. Read more
sourcefn total_swap(&self) -> u64
fn total_swap(&self) -> u64
Returns the SWAP size in bytes. Read more
sourcefn components(&self) -> &[Component]
fn components(&self) -> &[Component]
Returns the components list. Read more
sourcefn components_mut(&mut self) -> &mut [Component]
fn components_mut(&mut self) -> &mut [Component]
Returns a mutable components list. Read more
sourcefn sort_disks_by<F>(&mut self, compare: F)where
F: FnMut(&Disk, &Disk) -> Ordering,
fn sort_disks_by<F>(&mut self, compare: F)where
F: FnMut(&Disk, &Disk) -> Ordering,
Sort the disk list with the provided callback. Read more
sourcefn networks_mut(&mut self) -> &mut Networks
fn networks_mut(&mut self) -> &mut Networks
Returns a mutable access to network interfaces. Read more
sourcefn boot_time(&self) -> u64
fn boot_time(&self) -> u64
Returns the time (in seconds) when the system booted since UNIX epoch. Read more
sourcefn load_average(&self) -> LoadAvg
fn load_average(&self) -> LoadAvg
Returns the system load average value. Read more
sourcefn long_os_version(&self) -> Option<String>
fn long_os_version(&self) -> Option<String>
Returns the system long os version (e.g “MacOS 11.2 BigSur”). Read more
sourcefn kernel_version(&self) -> Option<String>
fn kernel_version(&self) -> Option<String>
Returns the system’s kernel version. Read more
sourcefn os_version(&self) -> Option<String>
fn os_version(&self) -> Option<String>
Returns the system version (e.g. for MacOS this will return 11.1 rather than the kernel version). Read more
sourcefn distribution_id(&self) -> String
fn distribution_id(&self) -> String
Returns the distribution id as defined by os-release,
or
std::env::consts::OS
. Read moresourcefn new() -> Self
fn new() -> Self
Creates a new
System
instance with nothing loaded except the cpus list. If you
want to load components, network interfaces or the disks, you’ll have to use the
refresh_*_list
methods. SystemExt::refresh_networks_list
for example. Read moresourcefn refresh_specifics(&mut self, refreshes: RefreshKind)
fn refresh_specifics(&mut self, refreshes: RefreshKind)
Refreshes according to the given
RefreshKind
. It calls the corresponding
“refresh_” methods. Read moresourcefn refresh_all(&mut self)
fn refresh_all(&mut self)
Refreshes all system, processes, disks and network interfaces information. Read more
sourcefn refresh_system(&mut self)
fn refresh_system(&mut self)
Refreshes system information (RAM, swap, CPU usage and components’ temperature). Read more
sourcefn refresh_cpu(&mut self)
fn refresh_cpu(&mut self)
Refreshes CPUs information. Read more
sourcefn refresh_components(&mut self)
fn refresh_components(&mut self)
Refreshes components’ temperature. Read more
sourcefn refresh_processes(&mut self)
fn refresh_processes(&mut self)
Gets all processes and updates their information. Read more
sourcefn refresh_process(&mut self, pid: Pid) -> bool
fn refresh_process(&mut self, pid: Pid) -> bool
Refreshes only the process corresponding to
pid
. Returns false
if the process doesn’t
exist (it will NOT be removed from the processes if it doesn’t exist anymore). If it
isn’t listed yet, it’ll be added. Read moresourcefn refresh_disks(&mut self)
fn refresh_disks(&mut self)
Refreshes the listed disks’ information. Read more
sourcefn refresh_networks(&mut self)
fn refresh_networks(&mut self)
Refreshes networks data. Read more
sourcefn refresh_networks_list(&mut self)
fn refresh_networks_list(&mut self)
The network list will be updated: removing not existing anymore interfaces and adding new
ones. Read more
sourcefn processes_by_name<'a>(
&'a self,
name: &'a str
) -> Box<dyn Iterator<Item = &'a Process> + 'a>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn processes_by_name<'a>(
&'a self,
name: &'a str
) -> Box<dyn Iterator<Item = &'a Process> + 'a>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized,impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Returns an iterator of process containing the given
name
. Read moresourcefn processes_by_exact_name<'a>(
&'a self,
name: &'a str
) -> Box<dyn Iterator<Item = &'a Process> + 'a>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn processes_by_exact_name<'a>(
&'a self,
name: &'a str
) -> Box<dyn Iterator<Item = &'a Process> + 'a>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global>where
W: Write + ?Sized,impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized,impl<R> Read for Box<R, Global>where
R: Read + ?Sized,impl<F, A> Future for Box<F, A>where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A>where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Returns an iterator of processes with exactly the given
name
. Read moreAuto Trait Implementations
impl RefUnwindSafe for System
impl Send for System
impl Sync for System
impl Unpin for System
impl UnwindSafe for System
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more