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>
309 lines
62 KiB
HTML
309 lines
62 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="Struct containing information of a process."><title>Process 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="#">Process</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="#">Process</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#ios" title="iOS">iOS</a></li><li><a href="#apple-app-store" title="Apple app store">Apple app store</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.cmd" title="cmd">cmd</a></li><li><a href="#method.cpu_usage" title="cpu_usage">cpu_usage</a></li><li><a href="#method.cwd" title="cwd">cwd</a></li><li><a href="#method.disk_usage" title="disk_usage">disk_usage</a></li><li><a href="#method.effective_group_id" title="effective_group_id">effective_group_id</a></li><li><a href="#method.effective_user_id" title="effective_user_id">effective_user_id</a></li><li><a href="#method.environ" title="environ">environ</a></li><li><a href="#method.exe" title="exe">exe</a></li><li><a href="#method.group_id" title="group_id">group_id</a></li><li><a href="#method.kill" title="kill">kill</a></li><li><a href="#method.kill_with" title="kill_with">kill_with</a></li><li><a href="#method.memory" title="memory">memory</a></li><li><a href="#method.name" title="name">name</a></li><li><a href="#method.parent" title="parent">parent</a></li><li><a href="#method.pid" title="pid">pid</a></li><li><a href="#method.root" title="root">root</a></li><li><a href="#method.run_time" title="run_time">run_time</a></li><li><a href="#method.session_id" title="session_id">session_id</a></li><li><a href="#method.start_time" title="start_time">start_time</a></li><li><a href="#method.status" title="status">status</a></li><li><a href="#method.tasks" title="tasks">tasks</a></li><li><a href="#method.thread_kind" title="thread_kind">thread_kind</a></li><li><a href="#method.user_id" title="user_id">user_id</a></li><li><a href="#method.virtual_memory" title="virtual_memory">virtual_memory</a></li><li><a href="#method.wait" title="wait">wait</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Process" title="Debug">Debug</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Process" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Process" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Process" title="Send">Send</a></li><li><a href="#impl-Sync-for-Process" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Process" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Process" 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">Process</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#836-838">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Process { <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>Struct containing information of a process.</p>
|
||
<h3 id="ios"><a class="doc-anchor" href="#ios">§</a>iOS</h3>
|
||
<p>This information cannot be retrieved on iOS due to sandboxing.</p>
|
||
<h3 id="apple-app-store"><a class="doc-anchor" href="#apple-app-store">§</a>Apple app store</h3>
|
||
<p>If you are building a macOS Apple app store, it won’t be able
|
||
to retrieve this information.</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><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-Process" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#840-1346">Source</a><a href="#impl-Process" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Process.html" title="struct sysinfo::Process">Process</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.kill" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#857-859">Source</a><h4 class="code-header">pub fn <a href="#method.kill" class="fn">kill</a>(&self) -> <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>Sends <a href="enum.Signal.html#variant.Kill" title="variant sysinfo::Signal::Kill"><code>Signal::Kill</code></a> to the process (which is the only signal supported on all supported
|
||
platforms by this crate).</p>
|
||
<p>If you want to send another signal, take a look at <a href="struct.Process.html#method.kill_with" title="method sysinfo::Process::kill_with"><code>Process::kill_with</code></a>.</p>
|
||
<p>To get the list of the supported signals on this system, use
|
||
<a href="constant.SUPPORTED_SIGNALS.html" title="constant sysinfo::SUPPORTED_SIGNALS"><code>SUPPORTED_SIGNALS</code></a>.</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>)) {
|
||
process.kill();
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.kill_with" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#880-882">Source</a><h4 class="code-header">pub fn <a href="#method.kill_with" class="fn">kill_with</a>(&self, signal: <a class="enum" href="enum.Signal.html" title="enum sysinfo::Signal">Signal</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="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.bool.html">bool</a>></h4></section></summary><div class="docblock"><p>Sends the given <code>signal</code> to the process. If the signal doesn’t exist on this platform,
|
||
it’ll do nothing and will return <code>None</code>. Otherwise it’ll return if the signal was sent
|
||
successfully.</p>
|
||
<p>If you just want to kill the process, use <a href="struct.Process.html#method.kill" title="method sysinfo::Process::kill"><code>Process::kill</code></a> directly.</p>
|
||
<p>To get the list of the supported signals on this system, use
|
||
<a href="constant.SUPPORTED_SIGNALS.html" title="constant sysinfo::SUPPORTED_SIGNALS"><code>SUPPORTED_SIGNALS</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::{Pid, Signal, 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="kw">if </span>process.kill_with(Signal::Kill).is_none() {
|
||
<span class="macro">println!</span>(<span class="string">"This signal isn't supported on this platform"</span>);
|
||
}
|
||
}</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#904-906">Source</a><h4 class="code-header">pub fn <a href="#method.name" class="fn">name</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>Returns the name of the process.</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>
|
||
<p>If you are looking for a specific process, unless you know what you are
|
||
doing, in most cases it’s better to use <a href="struct.Process.html#method.exe" title="method sysinfo::Process::exe"><code>Process::exe</code></a> instead (which
|
||
can be empty sometimes!).</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.cmd" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#918-920">Source</a><h4 class="code-header">pub fn <a href="#method.cmd" class="fn">cmd</a>(&self) -> &[<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 command line.</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.cmd());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.exe" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#944-946">Source</a><h4 class="code-header">pub fn <a href="#method.exe" class="fn">exe</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="https://doc.rust-lang.org/1.92.0/std/path/struct.Path.html" title="struct std::path::Path">Path</a>></h4></section></summary><div class="docblock"><p>Returns the path to the process.</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.exe());
|
||
}</code></pre></div><h6 id="implementation-notes"><a class="doc-anchor" href="#implementation-notes">§</a>Implementation notes</h6>
|
||
<p>On Linux, this method will return an empty path if there
|
||
was an error trying to read <code>/proc/<pid>/exe</code>. This can
|
||
happen, for example, if the permission levels or UID namespaces
|
||
between the caller and target processes are different.</p>
|
||
<p>It is also the case that <code>cmd[0]</code> is <em>not</em> usually a correct
|
||
replacement for this.
|
||
A process <a href="https://man7.org/linux/man-pages/man5/proc.5.html">may change its <code>cmd[0]</code> value</a>
|
||
freely, making this an untrustworthy source of information.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.pid" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#958-960">Source</a><h4 class="code-header">pub fn <a href="#method.pid" class="fn">pid</a>(&self) -> <a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a></h4></section></summary><div class="docblock"><p>Returns the PID of the process.</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.pid());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.environ" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#972-974">Source</a><h4 class="code-header">pub fn <a href="#method.environ" class="fn">environ</a>(&self) -> &[<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 environment variables of the process.</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.environ());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.cwd" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#986-988">Source</a><h4 class="code-header">pub fn <a href="#method.cwd" class="fn">cwd</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="https://doc.rust-lang.org/1.92.0/std/path/struct.Path.html" title="struct std::path::Path">Path</a>></h4></section></summary><div class="docblock"><p>Returns the current working directory.</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.cwd());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.root" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1000-1002">Source</a><h4 class="code-header">pub fn <a href="#method.root" class="fn">root</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="https://doc.rust-lang.org/1.92.0/std/path/struct.Path.html" title="struct std::path::Path">Path</a>></h4></section></summary><div class="docblock"><p>Returns the path of the root directory.</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.root());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1025-1027">Source</a><h4 class="code-header">pub fn <a href="#method.memory" class="fn">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 memory usage (in bytes).</p>
|
||
<p>This method returns the <a href="https://en.wikipedia.org/wiki/Resident_set_size">size of the resident set</a>, that is, the amount of memory that the
|
||
process allocated and which is currently mapped in physical RAM. It does not include memory
|
||
that is swapped out, or, in some operating systems, that has been allocated but never used.</p>
|
||
<p>Thus, it represents exactly the amount of physical RAM that the process is using at the
|
||
present time, but it might not be a good indicator of the total memory that the process will
|
||
be using over its lifetime. For that purpose, you can try and use
|
||
<a href="struct.Process.html#method.virtual_memory" title="method sysinfo::Process::virtual_memory"><code>virtual_memory</code></a>.</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">"{} bytes"</span>, process.memory());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.virtual_memory" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1053-1055">Source</a><h4 class="code-header">pub fn <a href="#method.virtual_memory" class="fn">virtual_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 virtual memory usage (in bytes).</p>
|
||
<p>This method returns the <a href="https://en.wikipedia.org/wiki/Virtual_memory">size of virtual memory</a>, that is, the amount of memory that the
|
||
process can access, whether it is currently mapped in physical RAM or not. It includes
|
||
physical RAM, allocated but not used regions, swapped-out regions, and even memory
|
||
associated with <a href="https://en.wikipedia.org/wiki/Memory-mapped_file">memory-mapped files</a>.</p>
|
||
<p>This value has limitations though. Depending on the operating system and type of process,
|
||
this value might be a good indicator of the total memory that the process will be using over
|
||
its lifetime. However, for example, in the version 14 of MacOS this value is in the order of
|
||
the hundreds of gigabytes for every process, and thus not very informative. Moreover, if a
|
||
process maps into memory a very large file, this value will increase accordingly, even if
|
||
the process is not actively using the memory.</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">"{} bytes"</span>, process.virtual_memory());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.parent" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1067-1069">Source</a><h4 class="code-header">pub fn <a href="#method.parent" class="fn">parent</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.Pid.html" title="struct sysinfo::Pid">Pid</a>></h4></section></summary><div class="docblock"><p>Returns the parent PID.</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.parent());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.status" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1081-1083">Source</a><h4 class="code-header">pub fn <a href="#method.status" class="fn">status</a>(&self) -> <a class="enum" href="enum.ProcessStatus.html" title="enum sysinfo::ProcessStatus">ProcessStatus</a></h4></section></summary><div class="docblock"><p>Returns the status of the process.</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.status());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.start_time" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1095-1097">Source</a><h4 class="code-header">pub fn <a href="#method.start_time" class="fn">start_time</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 time where the process was started (in seconds) from epoch.</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">"Started at {} seconds"</span>, process.start_time());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.run_time" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1109-1111">Source</a><h4 class="code-header">pub fn <a href="#method.run_time" class="fn">run_time</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 for how much time the process has been running (in seconds).</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">"Running since {} seconds"</span>, process.run_time());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.cpu_usage" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1137-1139">Source</a><h4 class="code-header">pub fn <a href="#method.cpu_usage" class="fn">cpu_usage</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.f32.html">f32</a></h4></section></summary><div class="docblock"><p>Returns the total CPU usage (in %). Notice that it might be bigger than
|
||
100 if run on a multi-core machine.</p>
|
||
<p>If you want a value between 0% and 100%, divide the returned value by
|
||
the number of CPUs.</p>
|
||
<p>⚠️ To start to have accurate CPU usage, a process needs to be refreshed
|
||
<strong>twice</strong> because CPU usage computation is based on time diff (process
|
||
time on a given time period divided by total system time on the same
|
||
time period).</p>
|
||
<p>⚠️ If you want accurate CPU usage number, better leave a bit of time
|
||
between two calls of this method (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).</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.cpu_usage());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.disk_usage" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1162-1164">Source</a><h4 class="code-header">pub fn <a href="#method.disk_usage" class="fn">disk_usage</a>(&self) -> <a class="struct" href="struct.DiskUsage.html" title="struct sysinfo::DiskUsage">DiskUsage</a></h4></section></summary><div class="docblock"><p>Returns number of bytes read and written to disk.</p>
|
||
<p>⚠️ On Windows, this method actually returns <strong>ALL</strong> I/O read and
|
||
written bytes.</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="kw">let </span>disk_usage = process.disk_usage();
|
||
<span class="macro">println!</span>(<span class="string">"read bytes : new/total => {}/{}"</span>,
|
||
disk_usage.read_bytes,
|
||
disk_usage.total_read_bytes,
|
||
);
|
||
<span class="macro">println!</span>(<span class="string">"written bytes: new/total => {}/{}"</span>,
|
||
disk_usage.written_bytes,
|
||
disk_usage.total_written_bytes,
|
||
);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.user_id" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1182-1184">Source</a><h4 class="code-header">pub fn <a href="#method.user_id" class="fn">user_id</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.Uid.html" title="struct sysinfo::Uid">Uid</a>></h4></section></summary><div class="docblock"><p>Returns the ID of the owner user of this process or <code>None</code> if this
|
||
information couldn’t be retrieved. If you want to get the <a href="struct.User.html" title="struct sysinfo::User"><code>User</code></a> from
|
||
it, take a look at <a href="struct.Users.html#method.get_user_by_id" title="method sysinfo::Users::get_user_by_id"><code>Users::get_user_by_id</code></a>.</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();
|
||
|
||
<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">"User id for process 1337: {:?}"</span>, process.user_id());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.effective_user_id" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1208-1210">Source</a><h4 class="code-header">pub fn <a href="#method.effective_user_id" class="fn">effective_user_id</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.Uid.html" title="struct sysinfo::Uid">Uid</a>></h4></section></summary><div class="docblock"><p>Returns the user ID of the effective owner of this process or <code>None</code> if
|
||
this information couldn’t be retrieved. If you want to get the <a href="struct.User.html" title="struct sysinfo::User"><code>User</code></a>
|
||
from it, take a look at <a href="struct.Users.html#method.get_user_by_id" title="method sysinfo::Users::get_user_by_id"><code>Users::get_user_by_id</code></a>.</p>
|
||
<p>If you run something with <code>sudo</code>, the real user ID of the launched
|
||
process will be the ID of the user you are logged in as but effective
|
||
user ID will be <code>0</code> (i-e root).</p>
|
||
<p>⚠️ It always returns <code>None</code> on Windows.</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();
|
||
|
||
<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">"User id for process 1337: {:?}"</span>, process.effective_user_id());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.group_id" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1225-1227">Source</a><h4 class="code-header">pub fn <a href="#method.group_id" class="fn">group_id</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.Gid.html" title="struct sysinfo::Gid">Gid</a>></h4></section></summary><div class="docblock"><p>Returns the process group ID of the process.</p>
|
||
<p>⚠️ It always returns <code>None</code> on Windows.</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();
|
||
|
||
<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">"Group ID for process 1337: {:?}"</span>, process.group_id());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.effective_group_id" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1246-1248">Source</a><h4 class="code-header">pub fn <a href="#method.effective_group_id" class="fn">effective_group_id</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.Gid.html" title="struct sysinfo::Gid">Gid</a>></h4></section></summary><div class="docblock"><p>Returns the effective group ID of the process.</p>
|
||
<p>If you run something with <code>sudo</code>, the real group ID of the launched
|
||
process will be the primary group ID you are logged in as but effective
|
||
group ID will be <code>0</code> (i-e root).</p>
|
||
<p>⚠️ It always returns <code>None</code> on Windows.</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();
|
||
|
||
<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">"User id for process 1337: {:?}"</span>, process.effective_group_id());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.wait" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1263-1265">Source</a><h4 class="code-header">pub fn <a href="#method.wait" class="fn">wait</a>(&self)</h4></section></summary><div class="docblock"><p>Wait for process termination.</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();
|
||
|
||
<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">"Waiting for pid 1337"</span>);
|
||
process.wait();
|
||
<span class="macro">println!</span>(<span class="string">"Pid 1337 exited"</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.session_id" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1281-1283">Source</a><h4 class="code-header">pub fn <a href="#method.session_id" class="fn">session_id</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.Pid.html" title="struct sysinfo::Pid">Pid</a>></h4></section></summary><div class="docblock"><p>Returns the session ID for the current process or <code>None</code> if it couldn’t
|
||
be retrieved.</p>
|
||
<p>⚠️ This information is computed every time this method is called.</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();
|
||
|
||
<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">"Session ID for process 1337: {:?}"</span>, process.session_id());
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.tasks" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1305-1316">Source</a><h4 class="code-header">pub fn <a href="#method.tasks" class="fn">tasks</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="https://doc.rust-lang.org/1.92.0/std/collections/hash/set/struct.HashSet.html" title="struct std::collections::hash::set::HashSet">HashSet</a><<a class="struct" href="struct.Pid.html" title="struct sysinfo::Pid">Pid</a>>></h4></section></summary><div class="docblock"><p>Tasks run by this process. If there are none, returns <code>None</code>.</p>
|
||
<p>⚠️ This method always returns <code>None</code> on other platforms than Linux.</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();
|
||
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(process) = s.process(Pid::from(<span class="number">1337</span>)) {
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(tasks) = process.tasks() {
|
||
<span class="macro">println!</span>(<span class="string">"Listing tasks for process {:?}"</span>, process.pid());
|
||
<span class="kw">for </span>task_pid <span class="kw">in </span>tasks {
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(task) = s.process(<span class="kw-2">*</span>task_pid) {
|
||
<span class="macro">println!</span>(<span class="string">"Task {:?}: {:?}"</span>, task.pid(), task.name());
|
||
}
|
||
}
|
||
}
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.thread_kind" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#1334-1345">Source</a><h4 class="code-header">pub fn <a href="#method.thread_kind" class="fn">thread_kind</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="enum" href="enum.ThreadKind.html" title="enum sysinfo::ThreadKind">ThreadKind</a>></h4></section></summary><div class="docblock"><p>If the process is a thread, it’ll return <code>Some</code> with the kind of thread it is. Returns
|
||
<code>None</code> otherwise.</p>
|
||
<p>⚠️ This method always returns <code>None</code> on other platforms than Linux.</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>(<span class="kw">_</span>, process) <span class="kw">in </span>s.processes() {
|
||
<span class="kw">if let </span><span class="prelude-val">Some</span>(thread_kind) = process.thread_kind() {
|
||
<span class="macro">println!</span>(<span class="string">"Process {:?} is a {thread_kind:?} thread"</span>, process.pid());
|
||
}
|
||
}</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-Process" class="impl"><a class="src rightside" href="../src/sysinfo/debug.rs.html#52-72">Source</a><a href="#impl-Debug-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</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#53-71">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></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-Process" class="impl"><a href="#impl-Freeze-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</a></h3></section><section id="impl-RefUnwindSafe-for-Process" class="impl"><a href="#impl-RefUnwindSafe-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</a></h3></section><section id="impl-Send-for-Process" class="impl"><a href="#impl-Send-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</a></h3></section><section id="impl-Sync-for-Process" class="impl"><a href="#impl-Sync-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</a></h3></section><section id="impl-Unpin-for-Process" class="impl"><a href="#impl-Unpin-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</a></h3></section><section id="impl-UnwindSafe-for-Process" class="impl"><a href="#impl-UnwindSafe-for-Process" 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.Process.html" title="struct sysinfo::Process">Process</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> |