Major updates: - Complete Rust rewrite (pilot-v2/) with working MQTT client - Fixed MQTT event loop deadlock (background task pattern) - Battery telemetry for Linux (auto-detected via /sys/class/power_supply) - Home Assistant auto-discovery for all sensors and switches - Comprehensive documentation (AVANCEMENT.md, CLAUDE.md, roadmap) - Docker test environment with Mosquitto broker - Helper scripts for development and testing Features working: ✅ MQTT connectivity with LWT ✅ YAML configuration with validation ✅ Telemetry: CPU, memory, IP, battery (Linux) ✅ Commands: shutdown, reboot, sleep, screen (dry-run tested) ✅ HA discovery and integration ✅ Allowlist and cooldown protection Ready for testing on real hardware. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
396 lines
79 KiB
HTML
396 lines
79 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Structs containing system’s information such as processes, memory and CPU."><title>System in sysinfo - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="sysinfo" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0 (ded5c06cf 2025-12-08)" data-channel="1.92.0" data-search-js="search-d69d8955.js" data-stringdex-js="stringdex-c3e638e9.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">System</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../sysinfo/index.html">sysinfo</a><span class="version">0.30.13</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">System</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.available_memory" title="available_memory">available_memory</a></li><li><a href="#method.boot_time" title="boot_time">boot_time</a></li><li><a href="#method.cgroup_limits" title="cgroup_limits">cgroup_limits</a></li><li><a href="#method.cpu_arch" title="cpu_arch">cpu_arch</a></li><li><a href="#method.cpus" title="cpus">cpus</a></li><li><a href="#method.distribution_id" title="distribution_id">distribution_id</a></li><li><a href="#method.free_memory" title="free_memory">free_memory</a></li><li><a href="#method.free_swap" title="free_swap">free_swap</a></li><li><a href="#method.global_cpu_info" title="global_cpu_info">global_cpu_info</a></li><li><a href="#method.host_name" title="host_name">host_name</a></li><li><a href="#method.kernel_version" title="kernel_version">kernel_version</a></li><li><a href="#method.load_average" title="load_average">load_average</a></li><li><a href="#method.long_os_version" title="long_os_version">long_os_version</a></li><li><a href="#method.name" title="name">name</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.new_all" title="new_all">new_all</a></li><li><a href="#method.new_with_specifics" title="new_with_specifics">new_with_specifics</a></li><li><a href="#method.os_version" title="os_version">os_version</a></li><li><a href="#method.physical_core_count" title="physical_core_count">physical_core_count</a></li><li><a href="#method.process" title="process">process</a></li><li><a href="#method.processes" title="processes">processes</a></li><li><a href="#method.processes_by_exact_name" title="processes_by_exact_name">processes_by_exact_name</a></li><li><a href="#method.processes_by_name" title="processes_by_name">processes_by_name</a></li><li><a href="#method.refresh_all" title="refresh_all">refresh_all</a></li><li><a href="#method.refresh_cpu" title="refresh_cpu">refresh_cpu</a></li><li><a href="#method.refresh_cpu_frequency" title="refresh_cpu_frequency">refresh_cpu_frequency</a></li><li><a href="#method.refresh_cpu_specifics" title="refresh_cpu_specifics">refresh_cpu_specifics</a></li><li><a href="#method.refresh_cpu_usage" title="refresh_cpu_usage">refresh_cpu_usage</a></li><li><a href="#method.refresh_memory" title="refresh_memory">refresh_memory</a></li><li><a href="#method.refresh_memory_specifics" title="refresh_memory_specifics">refresh_memory_specifics</a></li><li><a href="#method.refresh_pids" title="refresh_pids">refresh_pids</a></li><li><a href="#method.refresh_pids_specifics" title="refresh_pids_specifics">refresh_pids_specifics</a></li><li><a href="#method.refresh_process" title="refresh_process">refresh_process</a></li><li><a href="#method.refresh_process_specifics" title="refresh_process_specifics">refresh_process_specifics</a></li><li><a href="#method.refresh_processes" title="refresh_processes">refresh_processes</a></li><li><a href="#method.refresh_processes_specifics" title="refresh_processes_specifics">refresh_processes_specifics</a></li><li><a href="#method.refresh_specifics" title="refresh_specifics">refresh_specifics</a></li><li><a href="#method.total_memory" title="total_memory">total_memory</a></li><li><a href="#method.total_swap" title="total_swap">total_swap</a></li><li><a href="#method.uptime" title="uptime">uptime</a></li><li><a href="#method.used_memory" title="used_memory">used_memory</a></li><li><a href="#method.used_swap" title="used_swap">used_swap</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-System" title="Debug">Debug</a></li><li><a href="#impl-Default-for-System" title="Default">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-System" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-System" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-System" title="Send">Send</a></li><li><a href="#impl-Sync-for-System" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-System" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-System" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-IntoEither-for-T" title="IntoEither">IntoEither</a></li><li><a href="#impl-Pointable-for-T" title="Pointable">Pointable</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate sysinfo</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">sysinfo</a></div><h1>Struct <span class="struct">System</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/sysinfo/common.rs.html#27-29">Source</a> </span></div><pre class="rust item-decl"><code>pub struct System { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Structs containing system’s information such as processes, memory and CPU.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">if </span>sysinfo::IS_SUPPORTED_SYSTEM {
|
||
<span class="macro">println!</span>(<span class="string">"System: {:?}"</span>, System::new_all());
|
||
} <span class="kw">else </span>{
|
||
<span class="macro">println!</span>(<span class="string">"This OS isn't supported (yet?)."</span>);
|
||
}</code></pre></div></div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-System" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#37-815">Source</a><a href="#impl-System" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#50-52">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.System.html" title="struct sysinfo::System"><code>System</code></a> instance with nothing loaded.</p>
|
||
<p>Use one of the refresh methods (like <a href="#method.refresh_all"><code>refresh_all</code></a>) to update its internal information.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.new_all" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#65-67">Source</a><h4 class="code-header">pub fn <a href="#method.new_all" class="fn">new_all</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.System.html" title="struct sysinfo::System"><code>System</code></a> instance with everything loaded.</p>
|
||
<p>It is an equivalent of <a href="struct.System.html#method.new_with_specifics" title="associated function sysinfo::System::new_with_specifics"><code>System::new_with_specifics</code></a><code>(</code><a href="struct.RefreshKind.html#method.everything" title="associated function sysinfo::RefreshKind::everything"><code>RefreshKind::everything</code></a><code>())</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.new_with_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#86-92">Source</a><h4 class="code-header">pub fn <a href="#method.new_with_specifics" class="fn">new_with_specifics</a>(refreshes: <a class="struct" href="struct.RefreshKind.html" title="struct sysinfo::RefreshKind">RefreshKind</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.System.html" title="struct sysinfo::System"><code>System</code></a> instance and refresh the data corresponding to the
|
||
given <a href="struct.RefreshKind.html" title="struct sysinfo::RefreshKind"><code>RefreshKind</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{ProcessRefreshKind, RefreshKind, System};
|
||
|
||
<span class="comment">// We want to only refresh processes.
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>system = System::new_with_specifics(
|
||
RefreshKind::new().with_processes(ProcessRefreshKind::everything()),
|
||
);
|
||
|
||
<span class="macro">assert!</span>(!system.processes().is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#107-117">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_specifics" class="fn">refresh_specifics</a>(&mut self, refreshes: <a class="struct" href="struct.RefreshKind.html" title="struct sysinfo::RefreshKind">RefreshKind</a>)</h4></section></summary><div class="docblock"><p>Refreshes according to the given <a href="struct.RefreshKind.html" title="struct sysinfo::RefreshKind"><code>RefreshKind</code></a>. It calls the corresponding
|
||
“refresh_” methods.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{ProcessRefreshKind, RefreshKind, System};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
|
||
<span class="comment">// Let's just update processes:
|
||
</span>s.refresh_specifics(
|
||
RefreshKind::new().with_processes(ProcessRefreshKind::everything()),
|
||
);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_all" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#132-134">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_all" class="fn">refresh_all</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes all system and processes information.</p>
|
||
<p>It is the same as calling <code>system.refresh_specifics(RefreshKind::everything())</code>.</p>
|
||
<p>Don’t forget to take a look at <a href="struct.ProcessRefreshKind.html#method.everything" title="associated function sysinfo::ProcessRefreshKind::everything"><code>ProcessRefreshKind::everything</code></a> method to see what it
|
||
will update for processes more in details.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new();
|
||
s.refresh_all();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#148-150">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_memory" class="fn">refresh_memory</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes RAM and SWAP usage.</p>
|
||
<p>It is the same as calling <code>system.refresh_memory_specifics(MemoryRefreshKind::everything())</code>.</p>
|
||
<p>If you don’t want to refresh both, take a look at <a href="struct.System.html#method.refresh_memory_specifics" title="method sysinfo::System::refresh_memory_specifics"><code>System::refresh_memory_specifics</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new();
|
||
s.refresh_memory();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_memory_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#160-162">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_memory_specifics" class="fn">refresh_memory_specifics</a>(&mut self, refresh_kind: <a class="struct" href="struct.MemoryRefreshKind.html" title="struct sysinfo::MemoryRefreshKind">MemoryRefreshKind</a>)</h4></section></summary><div class="docblock"><p>Refreshes system memory specific information.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{MemoryRefreshKind, System};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new();
|
||
s.refresh_memory_specifics(MemoryRefreshKind::new().with_ram());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_cpu_usage" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#182-184">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_cpu_usage" class="fn">refresh_cpu_usage</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes CPUs usage.</p>
|
||
<p>⚠️ Please note that the result will very likely be inaccurate at the first call.
|
||
You need to call this method at least twice (with a bit of time between each call, like
|
||
200 ms, take a look at <a href="constant.MINIMUM_CPU_UPDATE_INTERVAL.html" title="constant sysinfo::MINIMUM_CPU_UPDATE_INTERVAL"><code>MINIMUM_CPU_UPDATE_INTERVAL</code></a> for more information)
|
||
to get accurate value as it uses previous results to compute the next value.</p>
|
||
<p>Calling this method is the same as calling
|
||
<code>system.refresh_cpu_specifics(CpuRefreshKind::new().with_cpu_usage())</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_cpu_usage();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_cpu_frequency" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#197-199">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_cpu_frequency" class="fn">refresh_cpu_frequency</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes CPUs frequency information.</p>
|
||
<p>Calling this method is the same as calling
|
||
<code>system.refresh_cpu_specifics(CpuRefreshKind::new().with_frequency())</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_cpu_frequency();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_cpu" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#219-221">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_cpu" class="fn">refresh_cpu</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes all information related to CPUs information.</p>
|
||
<p>⚠️ Please note that the result will very likely be inaccurate at the first call.
|
||
You need to call this method at least twice (with a bit of time between each call, like
|
||
200 ms, take a look at <a href="constant.MINIMUM_CPU_UPDATE_INTERVAL.html" title="constant sysinfo::MINIMUM_CPU_UPDATE_INTERVAL"><code>MINIMUM_CPU_UPDATE_INTERVAL</code></a> for more information)
|
||
to get accurate value as it uses previous results to compute the next value.</p>
|
||
<p>Calling this method is the same as calling
|
||
<code>system.refresh_cpu_specifics(CpuRefreshKind::everything())</code>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_cpu();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_cpu_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#231-233">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_cpu_specifics" class="fn">refresh_cpu_specifics</a>(&mut self, refresh_kind: <a class="struct" href="struct.CpuRefreshKind.html" title="struct sysinfo::CpuRefreshKind">CpuRefreshKind</a>)</h4></section></summary><div class="docblock"><p>Refreshes CPUs specific information.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{System, CpuRefreshKind};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_cpu_specifics(CpuRefreshKind::everything());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_processes" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#262-270">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_processes" class="fn">refresh_processes</a>(&mut self)</h4></section></summary><div class="docblock"><p>Gets all processes and updates their information.</p>
|
||
<p>It does the same as:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>system.refresh_processes_specifics(
|
||
ProcessRefreshKind::new()
|
||
.with_memory()
|
||
.with_cpu()
|
||
.with_disk_usage()
|
||
.with_exe(UpdateKind::OnlyIfNotSet),
|
||
);</code></pre></div>
|
||
<p>⚠️ On Linux, <code>sysinfo</code> keeps the <code>stat</code> files open by default. You can change this behaviour
|
||
by using <a href="fn.set_open_files_limit.html" title="fn sysinfo::set_open_files_limit"><code>set_open_files_limit</code></a>.</p>
|
||
<p>Example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_processes();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_processes_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#283-285">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_processes_specifics" class="fn">refresh_processes_specifics</a>(&mut self, refresh_kind: <a class="struct" href="struct.ProcessRefreshKind.html" title="struct sysinfo::ProcessRefreshKind">ProcessRefreshKind</a>)</h4></section></summary><div class="docblock"><p>Gets all processes and updates the specified information.</p>
|
||
<p>⚠️ On Linux, <code>sysinfo</code> keeps the <code>stat</code> files open by default. You can change this behaviour
|
||
by using <a href="fn.set_open_files_limit.html" title="fn sysinfo::set_open_files_limit"><code>set_open_files_limit</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{ProcessRefreshKind, System};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_processes_specifics(ProcessRefreshKind::new());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_pids" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#315-324">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_pids" class="fn">refresh_pids</a>(&mut self, pids: &[<a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>])</h4></section></summary><div class="docblock"><p>Gets specified processes and updates their information.</p>
|
||
<p>It does the same as:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>system.refresh_pids_specifics(
|
||
<span class="kw-2">&</span>[Pid::from(<span class="number">1</span>), Pid::from(<span class="number">2</span>)],
|
||
ProcessRefreshKind::new()
|
||
.with_memory()
|
||
.with_cpu()
|
||
.with_disk_usage()
|
||
.with_exe(UpdateKind::OnlyIfNotSet),
|
||
);</code></pre></div>
|
||
<p>⚠️ On Linux, <code>sysinfo</code> keeps the <code>stat</code> files open by default. You can change this behaviour
|
||
by using <a href="fn.set_open_files_limit.html" title="fn sysinfo::set_open_files_limit"><code>set_open_files_limit</code></a>.</p>
|
||
<p>Example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_processes();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_pids_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#337-343">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_pids_specifics" class="fn">refresh_pids_specifics</a>(
|
||
&mut self,
|
||
pids: &[<a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>],
|
||
refresh_kind: <a class="struct" href="struct.ProcessRefreshKind.html" title="struct sysinfo::ProcessRefreshKind">ProcessRefreshKind</a>,
|
||
)</h4></section></summary><div class="docblock"><p>Gets specified processes and updates the specified information.</p>
|
||
<p>⚠️ On Linux, <code>sysinfo</code> keeps the <code>stat</code> files open by default. You can change this behaviour
|
||
by using <a href="fn.set_open_files_limit.html" title="fn sysinfo::set_open_files_limit"><code>set_open_files_limit</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{Pid, ProcessRefreshKind, System};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_pids_specifics(<span class="kw-2">&</span>[Pid::from(<span class="number">1</span>), Pid::from(<span class="number">2</span>)], ProcessRefreshKind::new());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_process" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#376-385">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_process" class="fn">refresh_process</a>(&mut self, pid: <a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Refreshes <em>only</em> the process corresponding to <code>pid</code>. Returns <code>false</code> if the process doesn’t
|
||
exist (it will <strong>NOT</strong> be removed from the processes if it doesn’t exist anymore). If it
|
||
isn’t listed yet, it’ll be added.</p>
|
||
<p>It is the same as calling:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>system.refresh_process_specifics(
|
||
pid,
|
||
ProcessRefreshKind::new()
|
||
.with_memory()
|
||
.with_cpu()
|
||
.with_disk_usage()
|
||
.with_exe(UpdateKind::OnlyIfNotSet),
|
||
);</code></pre></div>
|
||
<p>⚠️ On Linux, <code>sysinfo</code> keeps the <code>stat</code> files open by default. You can change this behaviour
|
||
by using <a href="fn.set_open_files_limit.html" title="fn sysinfo::set_open_files_limit"><code>set_open_files_limit</code></a>.</p>
|
||
<p>Example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{Pid, System};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_process(Pid::from(<span class="number">1337</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_process_specifics" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#400-406">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_process_specifics" class="fn">refresh_process_specifics</a>(
|
||
&mut self,
|
||
pid: <a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>,
|
||
refresh_kind: <a class="struct" href="struct.ProcessRefreshKind.html" title="struct sysinfo::ProcessRefreshKind">ProcessRefreshKind</a>,
|
||
) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Refreshes <em>only</em> the process corresponding to <code>pid</code>. Returns <code>false</code> if the process doesn’t
|
||
exist (it will <strong>NOT</strong> be removed from the processes if it doesn’t exist anymore). If it
|
||
isn’t listed yet, it’ll be added.</p>
|
||
<p>⚠️ On Linux, <code>sysinfo</code> keeps the <code>stat</code> files open by default. You can change this behaviour
|
||
by using <a href="fn.set_open_files_limit.html" title="fn sysinfo::set_open_files_limit"><code>set_open_files_limit</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{Pid, ProcessRefreshKind, System};
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>s = System::new_all();
|
||
s.refresh_process_specifics(Pid::from(<span class="number">1337</span>), ProcessRefreshKind::new());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.processes" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#418-420">Source</a><h4 class="code-header">pub fn <a href="#method.processes" class="fn">processes</a>(&self) -> &<a class="struct" href="https://doc.rust-lang.org/1.92.0/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a><<a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>, <a class="struct" href="struct.Process.html" title="struct sysinfo::Process">Process</a>></h4></section></summary><div class="docblock"><p>Returns the process list.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="kw">for </span>(pid, process) <span class="kw">in </span>s.processes() {
|
||
<span class="macro">println!</span>(<span class="string">"{} {}"</span>, pid, process.name());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.process" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#432-434">Source</a><h4 class="code-header">pub fn <a href="#method.process" class="fn">process</a>(&self, pid: <a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="struct.Process.html" title="struct sysinfo::Process">Process</a>></h4></section></summary><div class="docblock"><p>Returns the process corresponding to the given <code>pid</code> or <code>None</code> if no such process exists.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{Pid, System};
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(process) = s.process(Pid::from(<span class="number">1337</span>)) {
|
||
<span class="macro">println!</span>(<span class="string">"{}"</span>, process.name());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.processes_by_name" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#455-462">Source</a><h4 class="code-header">pub fn <a href="#method.processes_by_name" class="fn">processes_by_name</a><'a: 'b, 'b>(
|
||
&'a self,
|
||
name: &'b <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.str.html">str</a>,
|
||
) -> impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &'a <a class="struct" href="struct.Process.html" title="struct sysinfo::Process">Process</a>> + 'b</h4></section></summary><div class="docblock"><p>Returns an iterator of process containing the given <code>name</code>.</p>
|
||
<p>If you want only the processes with exactly the given <code>name</code>, take a look at
|
||
<a href="struct.System.html#method.processes_by_exact_name" title="method sysinfo::System::processes_by_exact_name"><code>System::processes_by_exact_name</code></a>.</p>
|
||
<p><strong>⚠️ Important ⚠️</strong></p>
|
||
<p>On <strong>Linux</strong>, there are two things to know about processes’ name:</p>
|
||
<ol>
|
||
<li>It is limited to 15 characters.</li>
|
||
<li>It is not always the exe name.</li>
|
||
</ol>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="kw">for </span>process <span class="kw">in </span>s.processes_by_name(<span class="string">"htop"</span>) {
|
||
<span class="macro">println!</span>(<span class="string">"{} {}"</span>, process.pid(), process.name());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.processes_by_exact_name" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#483-490">Source</a><h4 class="code-header">pub fn <a href="#method.processes_by_exact_name" class="fn">processes_by_exact_name</a><'a: 'b, 'b>(
|
||
&'a self,
|
||
name: &'b <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.str.html">str</a>,
|
||
) -> impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &'a <a class="struct" href="struct.Process.html" title="struct sysinfo::Process">Process</a>> + 'b</h4></section></summary><div class="docblock"><p>Returns an iterator of processes with exactly the given <code>name</code>.</p>
|
||
<p>If you instead want the processes containing <code>name</code>, take a look at
|
||
<a href="struct.System.html#method.processes_by_name" title="method sysinfo::System::processes_by_name"><code>System::processes_by_name</code></a>.</p>
|
||
<p><strong>⚠️ Important ⚠️</strong></p>
|
||
<p>On <strong>Linux</strong>, there are two things to know about processes’ name:</p>
|
||
<ol>
|
||
<li>It is limited to 15 characters.</li>
|
||
<li>It is not always the exe name.</li>
|
||
</ol>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="kw">for </span>process <span class="kw">in </span>s.processes_by_exact_name(<span class="string">"htop"</span>) {
|
||
<span class="macro">println!</span>(<span class="string">"{} {}"</span>, process.pid(), process.name());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.global_cpu_info" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#514-516">Source</a><h4 class="code-header">pub fn <a href="#method.global_cpu_info" class="fn">global_cpu_info</a>(&self) -> &<a class="struct" href="struct.Cpu.html" title="struct sysinfo::Cpu">Cpu</a></h4></section></summary><div class="docblock"><p>Returns “global” CPUs information (aka the addition of all the CPUs).</p>
|
||
<p>To have up-to-date information, you need to call <a href="struct.System.html#method.refresh_cpu" title="method sysinfo::System::refresh_cpu"><code>System::refresh_cpu</code></a> or
|
||
<a href="struct.System.html#method.refresh_specifics" title="method sysinfo::System::refresh_specifics"><code>System::refresh_specifics</code></a> with <code>cpu</code> enabled.</p>
|
||
<p><strong>⚠️ Important ⚠️</strong></p>
|
||
<p>Information like <a href="struct.Cpu.html#method.brand" title="method sysinfo::Cpu::brand"><code>Cpu::brand</code></a>, <a href="struct.Cpu.html#method.vendor_id" title="method sysinfo::Cpu::vendor_id"><code>Cpu::vendor_id</code></a> or <a href="struct.Cpu.html#method.frequency" title="method sysinfo::Cpu::frequency"><code>Cpu::frequency</code></a>
|
||
are not set on the “global” CPU.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{CpuRefreshKind, RefreshKind, System};
|
||
|
||
<span class="kw">let </span>s = System::new_with_specifics(
|
||
RefreshKind::new().with_cpu(CpuRefreshKind::everything()),
|
||
);
|
||
<span class="macro">println!</span>(<span class="string">"{}%"</span>, s.global_cpu_info().cpu_usage());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.cpus" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#533-535">Source</a><h4 class="code-header">pub fn <a href="#method.cpus" class="fn">cpus</a>(&self) -> &[<a class="struct" href="struct.Cpu.html" title="struct sysinfo::Cpu">Cpu</a>]</h4></section></summary><div class="docblock"><p>Returns the list of the CPUs.</p>
|
||
<p>By default, the list of CPUs is empty until you call <a href="struct.System.html#method.refresh_cpu" title="method sysinfo::System::refresh_cpu"><code>System::refresh_cpu</code></a> or
|
||
<a href="struct.System.html#method.refresh_specifics" title="method sysinfo::System::refresh_specifics"><code>System::refresh_specifics</code></a> with <code>cpu</code> enabled.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{CpuRefreshKind, RefreshKind, System};
|
||
|
||
<span class="kw">let </span>s = System::new_with_specifics(
|
||
RefreshKind::new().with_cpu(CpuRefreshKind::everything()),
|
||
);
|
||
<span class="kw">for </span>cpu <span class="kw">in </span>s.cpus() {
|
||
<span class="macro">println!</span>(<span class="string">"{}%"</span>, cpu.cpu_usage());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.physical_core_count" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#549-551">Source</a><h4 class="code-header">pub fn <a href="#method.physical_core_count" class="fn">physical_core_count</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.usize.html">usize</a>></h4></section></summary><div class="docblock"><p>Returns the number of physical cores on the CPU or <code>None</code> if it couldn’t get it.</p>
|
||
<p>In case there are multiple CPUs, it will combine the physical core count of all the CPUs.</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new();
|
||
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, s.physical_core_count());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.total_memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#564-566">Source</a><h4 class="code-header">pub fn <a href="#method.total_memory" class="fn">total_memory</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the RAM size in bytes.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.total_memory());</code></pre></div>
|
||
<p>On Linux, if you want to see this information with the limit of your cgroup, take a look
|
||
at <a href="struct.System.html#method.cgroup_limits" title="method sysinfo::System::cgroup_limits"><code>cgroup_limits</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.free_memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#582-584">Source</a><h4 class="code-header">pub fn <a href="#method.free_memory" class="fn">free_memory</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the amount of free RAM in bytes.</p>
|
||
<p>Generally, “free” memory refers to unallocated memory whereas “available” memory refers to
|
||
memory that is available for (re)use.</p>
|
||
<p>Side note: Windows doesn’t report “free” memory so this method returns the same value
|
||
as <a href="struct.System.html#method.available_memory" title="method sysinfo::System::available_memory"><code>available_memory</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.free_memory());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.available_memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#600-602">Source</a><h4 class="code-header">pub fn <a href="#method.available_memory" class="fn">available_memory</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the amount of available RAM in bytes.</p>
|
||
<p>Generally, “free” memory refers to unallocated memory whereas “available” memory refers to
|
||
memory that is available for (re)use.</p>
|
||
<p>⚠️ Windows and FreeBSD don’t report “available” memory so <a href="struct.System.html#method.free_memory" title="method sysinfo::System::free_memory"><code>System::free_memory</code></a>
|
||
returns the same value as this method.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.available_memory());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.used_memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#612-614">Source</a><h4 class="code-header">pub fn <a href="#method.used_memory" class="fn">used_memory</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the amount of used RAM in bytes.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.used_memory());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.total_swap" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#624-626">Source</a><h4 class="code-header">pub fn <a href="#method.total_swap" class="fn">total_swap</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the SWAP size in bytes.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.total_swap());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.free_swap" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#636-638">Source</a><h4 class="code-header">pub fn <a href="#method.free_swap" class="fn">free_swap</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the amount of free SWAP in bytes.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.free_swap());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.used_swap" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#648-650">Source</a><h4 class="code-header">pub fn <a href="#method.used_swap" class="fn">used_swap</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the amount of used SWAP in bytes.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"{} bytes"</span>, s.used_swap());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.cgroup_limits" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#668-670">Source</a><h4 class="code-header">pub fn <a href="#method.cgroup_limits" class="fn">cgroup_limits</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.CGroupLimits.html" title="struct sysinfo::CGroupLimits">CGroupLimits</a>></h4></section></summary><div class="docblock"><p>Retrieves the limits for the current cgroup (if any), otherwise it returns <code>None</code>.</p>
|
||
<p>This information is computed every time the method is called.</p>
|
||
<p>⚠️ You need to have run <a href="struct.System.html#method.refresh_memory" title="method sysinfo::System::refresh_memory"><code>refresh_memory</code></a> at least once before
|
||
calling this method.</p>
|
||
<p>⚠️ This method is only implemented for Linux. It always returns <code>None</code> for all other
|
||
systems.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>s = System::new_all();
|
||
<span class="macro">println!</span>(<span class="string">"limits: {:?}"</span>, s.cgroup_limits());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.uptime" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#681-683">Source</a><h4 class="code-header">pub fn <a href="#method.uptime" class="fn">uptime</a>() -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns system uptime (in seconds).</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"System running since {} seconds"</span>, System::uptime());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.boot_time" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#694-696">Source</a><h4 class="code-header">pub fn <a href="#method.boot_time" class="fn">boot_time</a>() -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Returns the time (in seconds) when the system booted since UNIX epoch.</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"System booted at {} seconds"</span>, System::boot_time());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.load_average" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#715-717">Source</a><h4 class="code-header">pub fn <a href="#method.load_average" class="fn">load_average</a>() -> <a class="struct" href="struct.LoadAvg.html" title="struct sysinfo::LoadAvg">LoadAvg</a></h4></section></summary><div class="docblock"><p>Returns the system load average value.</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
<p>⚠️ This is currently not working on <strong>Windows</strong>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="kw">let </span>load_avg = System::load_average();
|
||
<span class="macro">println!</span>(
|
||
<span class="string">"one minute: {}%, five minutes: {}%, fifteen minutes: {}%"</span>,
|
||
load_avg.one,
|
||
load_avg.five,
|
||
load_avg.fifteen,
|
||
);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.name" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#728-730">Source</a><h4 class="code-header">pub fn <a href="#method.name" class="fn">name</a>() -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></summary><div class="docblock"><p>Returns the system name.</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"OS: {:?}"</span>, System::name());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.kernel_version" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#741-743">Source</a><h4 class="code-header">pub fn <a href="#method.kernel_version" class="fn">kernel_version</a>() -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></summary><div class="docblock"><p>Returns the system’s kernel version.</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"kernel version: {:?}"</span>, System::kernel_version());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.os_version" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#755-757">Source</a><h4 class="code-header">pub fn <a href="#method.os_version" class="fn">os_version</a>() -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></summary><div class="docblock"><p>Returns the system version (e.g. for MacOS this will return 11.1 rather than the kernel
|
||
version).</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"OS version: {:?}"</span>, System::os_version());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.long_os_version" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#768-770">Source</a><h4 class="code-header">pub fn <a href="#method.long_os_version" class="fn">long_os_version</a>() -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></summary><div class="docblock"><p>Returns the system long os version (e.g “MacOS 11.2 BigSur”).</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"Long OS Version: {:?}"</span>, System::long_os_version());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.distribution_id" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#786-788">Source</a><h4 class="code-header">pub fn <a href="#method.distribution_id" class="fn">distribution_id</a>() -> <a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Returns the distribution id as defined by os-release,
|
||
or <a href="https://doc.rust-lang.org/1.92.0/std/env/consts/constant.OS.html" title="constant std::env::consts::OS"><code>std::env::consts::OS</code></a>.</p>
|
||
<p>See also</p>
|
||
<ul>
|
||
<li><a href="https://www.freedesktop.org/software/systemd/man/os-release.html#ID=">https://www.freedesktop.org/software/systemd/man/os-release.html#ID=</a></li>
|
||
<li><a href="https://doc.rust-lang.org/std/env/consts/constant.OS.html">https://doc.rust-lang.org/std/env/consts/constant.OS.html</a></li>
|
||
</ul>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"Distribution ID: {:?}"</span>, System::distribution_id());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.host_name" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#799-801">Source</a><h4 class="code-header">pub fn <a href="#method.host_name" class="fn">host_name</a>() -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></summary><div class="docblock"><p>Returns the system hostname based off DNS.</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"Hostname: {:?}"</span>, System::host_name());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.cpu_arch" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#812-814">Source</a><h4 class="code-header">pub fn <a href="#method.cpu_arch" class="fn">cpu_arch</a>() -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></summary><div class="docblock"><p>Returns the CPU architecture (eg. x86, amd64, aarch64, …).</p>
|
||
<p><strong>Important</strong>: this information is computed every time this function is called.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::System;
|
||
|
||
<span class="macro">println!</span>(<span class="string">"CPU Architecture: {:?}"</span>, System::cpu_arch());</code></pre></div></div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-System" class="impl"><a class="src rightside" href="../src/sysinfo/debug.rs.html#21-34">Source</a><a href="#impl-Debug-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/sysinfo/debug.rs.html#22-33">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.92.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.92.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.92.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-System" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#31-35">Source</a><a href="#impl-Default-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#32-34">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.92.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-System" class="impl"><a href="#impl-Freeze-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section><section id="impl-RefUnwindSafe-for-System" class="impl"><a href="#impl-RefUnwindSafe-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section><section id="impl-Send-for-System" class="impl"><a href="#impl-Send-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section><section id="impl-Sync-for-System" class="impl"><a href="#impl-Sync-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section><section id="impl-Unpin-for-System" class="impl"><a href="#impl-Unpin-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section><section id="impl-UnwindSafe-for-System" class="impl"><a href="#impl-UnwindSafe-for-System" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.System.html" title="struct sysinfo::System">System</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.92.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.92.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/borrow.rs.html#212">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/borrow.rs.html#214">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/borrow.rs.html#221">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.92.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/borrow.rs.html#222">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#785">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#788">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#767-769">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#777">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-IntoEither-for-T" class="impl"><a class="src rightside" href="https://docs.rs/either/1/src/either/into_either.rs.html#64">Source</a><a href="#impl-IntoEither-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html" title="trait either::into_either::IntoEither">IntoEither</a> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_either" class="method trait-impl"><a class="src rightside" href="https://docs.rs/either/1/src/either/into_either.rs.html#29">Source</a><a href="#method.into_either" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either" class="fn">into_either</a>(self, into_left: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.bool.html">bool</a>) -> <a class="enum" href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either">Either</a><Self, Self></h4></section></summary><div class='docblock'>Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Left" title="variant either::Either::Left"><code>Left</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a>
|
||
if <code>into_left</code> is <code>true</code>.
|
||
Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Right" title="variant either::Either::Right"><code>Right</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a>
|
||
otherwise. <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.into_either_with" class="method trait-impl"><a class="src rightside" href="https://docs.rs/either/1/src/either/into_either.rs.html#55-57">Source</a><a href="#method.into_either_with" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either_with" class="fn">into_either_with</a><F>(self, into_left: F) -> <a class="enum" href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either">Either</a><Self, Self><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(&Self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.bool.html">bool</a>,</div></h4></section></summary><div class='docblock'>Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Left" title="variant either::Either::Left"><code>Left</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a>
|
||
if <code>into_left(&self)</code> returns <code>true</code>.
|
||
Converts <code>self</code> into a <a href="https://docs.rs/either/1/either/enum.Either.html#variant.Right" title="variant either::Either::Right"><code>Right</code></a> variant of <a href="https://docs.rs/either/1/either/enum.Either.html" title="enum either::Either"><code>Either<Self, Self></code></a>
|
||
otherwise. <a href="https://docs.rs/either/1/either/into_either/trait.IntoEither.html#method.into_either_with">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Pointable-for-T" class="impl"><a href="#impl-Pointable-for-T" class="anchor">§</a><h3 class="code-header">impl<T> Pointable for T</h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.ALIGN" class="associatedconstant trait-impl"><a href="#associatedconstant.ALIGN" class="anchor">§</a><h4 class="code-header">const <a class="constant">ALIGN</a>: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>The alignment of pointer.</div></details><details class="toggle" open><summary><section id="associatedtype.Init" class="associatedtype trait-impl"><a href="#associatedtype.Init" class="anchor">§</a><h4 class="code-header">type <a class="associatedtype">Init</a> = T</h4></section></summary><div class='docblock'>The type for initializers.</div></details><details class="toggle method-toggle" open><summary><section id="method.init" class="method trait-impl"><a href="#method.init" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">init</a>(init: <T as Pointable>::Init) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.usize.html">usize</a></h4></section></summary><div class='docblock'>Initializes a with the given initializer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a href="#method.deref" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref</a><'a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&'a T</a></h4></section></summary><div class='docblock'>Dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.deref_mut" class="method trait-impl"><a href="#method.deref_mut" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">deref_mut</a><'a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.usize.html">usize</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&'a mut T</a></h4></section></summary><div class='docblock'>Mutably dereferences the given pointer. <a>Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a href="#method.drop" class="anchor">§</a><h4 class="code-header">unsafe fn <a class="fn">drop</a>(ptr: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.usize.html">usize</a>)</h4></section></summary><div class='docblock'>Drops the object pointed to by the given pointer. <a>Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#827-829">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#831">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#834">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#811-813">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#815">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/convert/mod.rs.html#818">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.92.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.92.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html> |