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>
212 lines
63 KiB
HTML
212 lines
63 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="Interacting with network interfaces."><title>Networks 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="#">Networks</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="#">Networks</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.list" title="list">list</a></li><li><a href="#method.new" title="new">new</a></li><li><a href="#method.new_with_refreshed_list" title="new_with_refreshed_list">new_with_refreshed_list</a></li><li><a href="#method.refresh" title="refresh">refresh</a></li><li><a href="#method.refresh_list" title="refresh_list">refresh_list</a></li></ul><h3><a href="#deref-methods-HashMap%3CString,+NetworkData%3E">Methods from Deref<<wbr>Target=<wbr>Hash<wbr>Map<<wbr>String, Network<wbr>Data>></a></h3><ul class="block deref-methods"><li><a href="#method.capacity" title="capacity">capacity</a></li><li><a href="#method.contains_key" title="contains_key">contains_key</a></li><li><a href="#method.get" title="get">get</a></li><li><a href="#method.get_key_value" title="get_key_value">get_key_value</a></li><li><a href="#method.hasher" title="hasher">hasher</a></li><li><a href="#method.is_empty" title="is_empty">is_empty</a></li><li><a href="#method.iter" title="iter">iter</a></li><li><a href="#method.keys" title="keys">keys</a></li><li><a href="#method.len" title="len">len</a></li><li><a href="#method.values" title="values">values</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Debug-for-Networks" title="Debug">Debug</a></li><li><a href="#impl-Default-for-Networks" title="Default">Default</a></li><li><a href="#impl-Deref-for-Networks" title="Deref">Deref</a></li><li><a href="#impl-IntoIterator-for-%26Networks" title="IntoIterator">IntoIterator</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-Networks" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-Networks" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Networks" title="Send">Send</a></li><li><a href="#impl-Sync-for-Networks" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-Networks" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Networks" 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-Receiver-for-P" title="Receiver">Receiver</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">Networks</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#1957-1959">Source</a> </span></div><pre class="rust item-decl"><code>pub struct Networks { <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>Interacting with network interfaces.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::Networks;
|
||
|
||
<span class="kw">let </span>networks = Networks::new_with_refreshed_list();
|
||
<span class="kw">for </span>(interface_name, network) <span class="kw">in </span><span class="kw-2">&</span>networks {
|
||
<span class="macro">println!</span>(<span class="string">"[{interface_name}]: {network:?}"</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-Networks" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#1976-2059">Source</a><a href="#impl-Networks" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Networks.html" title="struct sysinfo::Networks">Networks</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#1990-1994">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 empty <a href="struct.Networks.html" title="struct sysinfo::Networks"><code>Networks</code></a> type.</p>
|
||
<p>If you want it to be filled directly, take a look at <a href="struct.Networks.html#method.new_with_refreshed_list" title="associated function sysinfo::Networks::new_with_refreshed_list"><code>Networks::new_with_refreshed_list</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::Networks;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>networks = Networks::new();
|
||
networks.refresh_list();
|
||
<span class="kw">for </span>(interface_name, network) <span class="kw">in </span><span class="kw-2">&</span>networks {
|
||
<span class="macro">println!</span>(<span class="string">"[{interface_name}]: {network:?}"</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.new_with_refreshed_list" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#2008-2012">Source</a><h4 class="code-header">pub fn <a href="#method.new_with_refreshed_list" class="fn">new_with_refreshed_list</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.Networks.html" title="struct sysinfo::Networks"><code>Networks</code></a> type with the disk list
|
||
loaded. It is a combination of <a href="struct.Networks.html#method.new" title="associated function sysinfo::Networks::new"><code>Networks::new</code></a> and
|
||
<a href="struct.Networks.html#method.refresh_list" title="method sysinfo::Networks::refresh_list"><code>Networks::refresh_list</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::Networks;
|
||
|
||
<span class="kw">let </span>networks = Networks::new_with_refreshed_list();
|
||
<span class="kw">for </span>network <span class="kw">in </span><span class="kw-2">&</span>networks {
|
||
<span class="macro">println!</span>(<span class="string">"{network:?}"</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.list" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#2024-2026">Source</a><h4 class="code-header">pub fn <a href="#method.list" class="fn">list</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="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="struct.NetworkData.html" title="struct sysinfo::NetworkData">NetworkData</a>></h4></section></summary><div class="docblock"><p>Returns the network interfaces map.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::Networks;
|
||
|
||
<span class="kw">let </span>networks = Networks::new_with_refreshed_list();
|
||
<span class="kw">for </span>network <span class="kw">in </span>networks.list() {
|
||
<span class="macro">println!</span>(<span class="string">"{network:?}"</span>);
|
||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh_list" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#2036-2038">Source</a><h4 class="code-header">pub fn <a href="#method.refresh_list" class="fn">refresh_list</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes the network interfaces list.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::Networks;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>networks = Networks::new();
|
||
networks.refresh_list();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.refresh" class="method"><a class="src rightside" href="../src/sysinfo/common.rs.html#2056-2058">Source</a><h4 class="code-header">pub fn <a href="#method.refresh" class="fn">refresh</a>(&mut self)</h4></section></summary><div class="docblock"><p>Refreshes the network interfaces’ content. If you didn’t run <a href="struct.Networks.html#method.refresh_list" title="method sysinfo::Networks::refresh_list"><code>Networks::refresh_list</code></a>
|
||
before, calling this method won’t do anything as no interfaces are present.</p>
|
||
<p>⚠️ If a network interface is added or removed, this method won’t take it into account. Use
|
||
<a href="struct.Networks.html#method.refresh_list" title="method sysinfo::Networks::refresh_list"><code>Networks::refresh_list</code></a> instead.</p>
|
||
<p>⚠️ If you didn’t call <a href="struct.Networks.html#method.refresh_list" title="method sysinfo::Networks::refresh_list"><code>Networks::refresh_list</code></a> beforehand, this method will do nothing
|
||
as the network list will be empty.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>sysinfo::Networks;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>networks = Networks::new_with_refreshed_list();
|
||
<span class="comment">// Wait some time...? Then refresh the data of each network.
|
||
</span>networks.refresh();</code></pre></div></div></details></div></details></div><details class="toggle big-toggle" open><summary><h2 id="deref-methods-HashMap%3CString,+NetworkData%3E" class="section-header"><span>Methods from <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = <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="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="struct.NetworkData.html" title="struct sysinfo::NetworkData">NetworkData</a>>></span><a href="#deref-methods-HashMap%3CString,+NetworkData%3E" class="anchor">§</a></h2></summary><div id="deref-methods-HashMap%3CString,+NetworkData%3E-1" class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.capacity" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#365">Source</a></span><h4 class="code-header">pub fn <a href="#method.capacity" class="fn">capacity</a>(&self) -> <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 elements the map can hold without reallocating.</p>
|
||
<p>This number is a lower bound; the <code>HashMap<K, V></code> might be able to hold
|
||
more, but is guaranteed to be able to hold at least this many.</p>
|
||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
<span class="kw">let </span>map: HashMap<i32, i32> = HashMap::with_capacity(<span class="number">100</span>);
|
||
<span class="macro">assert!</span>(map.capacity() >= <span class="number">100</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.keys" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#394">Source</a></span><h4 class="code-header">pub fn <a href="#method.keys" class="fn">keys</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.92.0/std/collections/hash/map/struct.Keys.html" title="struct std::collections::hash::map::Keys">Keys</a><'_, K, V></h4></section></summary><div class="docblock"><p>An iterator visiting all keys in arbitrary order.
|
||
The iterator element type is <code>&'a K</code>.</p>
|
||
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span>map = HashMap::from([
|
||
(<span class="string">"a"</span>, <span class="number">1</span>),
|
||
(<span class="string">"b"</span>, <span class="number">2</span>),
|
||
(<span class="string">"c"</span>, <span class="number">3</span>),
|
||
]);
|
||
|
||
<span class="kw">for </span>key <span class="kw">in </span>map.keys() {
|
||
<span class="macro">println!</span>(<span class="string">"{key}"</span>);
|
||
}</code></pre></div><h5 id="performance"><a class="doc-anchor" href="#performance">§</a>Performance</h5>
|
||
<p>In the current implementation, iterating over keys takes O(capacity) time
|
||
instead of O(len) because it internally visits empty buckets too.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.values" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#456">Source</a></span><h4 class="code-header">pub fn <a href="#method.values" class="fn">values</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.92.0/std/collections/hash/map/struct.Values.html" title="struct std::collections::hash::map::Values">Values</a><'_, K, V></h4></section></summary><div class="docblock"><p>An iterator visiting all values in arbitrary order.
|
||
The iterator element type is <code>&'a V</code>.</p>
|
||
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span>map = HashMap::from([
|
||
(<span class="string">"a"</span>, <span class="number">1</span>),
|
||
(<span class="string">"b"</span>, <span class="number">2</span>),
|
||
(<span class="string">"c"</span>, <span class="number">3</span>),
|
||
]);
|
||
|
||
<span class="kw">for </span>val <span class="kw">in </span>map.values() {
|
||
<span class="macro">println!</span>(<span class="string">"{val}"</span>);
|
||
}</code></pre></div><h5 id="performance-1"><a class="doc-anchor" href="#performance-1">§</a>Performance</h5>
|
||
<p>In the current implementation, iterating over values takes O(capacity) time
|
||
instead of O(len) because it internally visits empty buckets too.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.iter" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#551">Source</a></span><h4 class="code-header">pub fn <a href="#method.iter" class="fn">iter</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.92.0/std/collections/hash/map/struct.Iter.html" title="struct std::collections::hash::map::Iter">Iter</a><'_, K, V></h4></section></summary><div class="docblock"><p>An iterator visiting all key-value pairs in arbitrary order.
|
||
The iterator element type is <code>(&'a K, &'a V)</code>.</p>
|
||
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span>map = HashMap::from([
|
||
(<span class="string">"a"</span>, <span class="number">1</span>),
|
||
(<span class="string">"b"</span>, <span class="number">2</span>),
|
||
(<span class="string">"c"</span>, <span class="number">3</span>),
|
||
]);
|
||
|
||
<span class="kw">for </span>(key, val) <span class="kw">in </span>map.iter() {
|
||
<span class="macro">println!</span>(<span class="string">"key: {key} val: {val}"</span>);
|
||
}</code></pre></div><h5 id="performance-2"><a class="doc-anchor" href="#performance-2">§</a>Performance</h5>
|
||
<p>In the current implementation, iterating over map takes O(capacity) time
|
||
instead of O(len) because it internally visits empty buckets too.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.len" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#603">Source</a></span><h4 class="code-header">pub fn <a href="#method.len" class="fn">len</a>(&self) -> <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 elements in the map.</p>
|
||
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = HashMap::new();
|
||
<span class="macro">assert_eq!</span>(a.len(), <span class="number">0</span>);
|
||
a.insert(<span class="number">1</span>, <span class="string">"a"</span>);
|
||
<span class="macro">assert_eq!</span>(a.len(), <span class="number">1</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#621">Source</a></span><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</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>Returns <code>true</code> if the map contains no elements.</p>
|
||
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>a = HashMap::new();
|
||
<span class="macro">assert!</span>(a.is_empty());
|
||
a.insert(<span class="number">1</span>, <span class="string">"a"</span>);
|
||
<span class="macro">assert!</span>(!a.is_empty());</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.hasher" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.9.0">1.9.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#760">Source</a></span><h4 class="code-header">pub fn <a href="#method.hasher" class="fn">hasher</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&S</a></h4></section></summary><div class="docblock"><p>Returns a reference to the map’s <a href="https://doc.rust-lang.org/1.92.0/core/hash/trait.BuildHasher.html" title="trait core::hash::BuildHasher"><code>BuildHasher</code></a>.</p>
|
||
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
<span class="kw">use </span>std::hash::RandomState;
|
||
|
||
<span class="kw">let </span>hasher = RandomState::new();
|
||
<span class="kw">let </span>map: HashMap<i32, i32> = HashMap::with_hasher(hasher);
|
||
<span class="kw">let </span>hasher: <span class="kw-2">&</span>RandomState = map.hasher();</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#909-912">Source</a></span><h4 class="code-header">pub fn <a href="#method.get" class="fn">get</a><Q>(&self, k: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&Q</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.reference.html">&V</a>><div class="where">where
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q>,
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<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></h4></section></summary><div class="docblock"><p>Returns a reference to the value corresponding to the key.</p>
|
||
<p>The key may be any borrowed form of the map’s key type, but
|
||
<a href="https://doc.rust-lang.org/1.92.0/core/hash/trait.Hash.html" title="trait core::hash::Hash"><code>Hash</code></a> and <a href="https://doc.rust-lang.org/1.92.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
|
||
the key type.</p>
|
||
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>map = HashMap::new();
|
||
map.insert(<span class="number">1</span>, <span class="string">"a"</span>);
|
||
<span class="macro">assert_eq!</span>(map.get(<span class="kw-2">&</span><span class="number">1</span>), <span class="prelude-val">Some</span>(<span class="kw-2">&</span><span class="string">"a"</span>));
|
||
<span class="macro">assert_eq!</span>(map.get(<span class="kw-2">&</span><span class="number">2</span>), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.get_key_value" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.40.0">1.40.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#967-970">Source</a></span><h4 class="code-header">pub fn <a href="#method.get_key_value" class="fn">get_key_value</a><Q>(&self, k: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&Q</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.reference.html">&K</a>, <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&V</a>)><div class="where">where
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q>,
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<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></h4></section></summary><div class="docblock"><p>Returns the key-value pair corresponding to the supplied key. This is
|
||
potentially useful:</p>
|
||
<ul>
|
||
<li>for key types where non-identical keys can be considered equal;</li>
|
||
<li>for getting the <code>&K</code> stored key value from a borrowed <code>&Q</code> lookup key; or</li>
|
||
<li>for getting a reference to a key with the same lifetime as the collection.</li>
|
||
</ul>
|
||
<p>The supplied key may be any borrowed form of the map’s key type, but
|
||
<a href="https://doc.rust-lang.org/1.92.0/core/hash/trait.Hash.html" title="trait core::hash::Hash"><code>Hash</code></a> and <a href="https://doc.rust-lang.org/1.92.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
|
||
the key type.</p>
|
||
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
<span class="kw">use </span>std::hash::{Hash, Hasher};
|
||
|
||
<span class="attr">#[derive(Clone, Copy, Debug)]
|
||
</span><span class="kw">struct </span>S {
|
||
id: u32,
|
||
name: <span class="kw-2">&</span><span class="lifetime">'static </span>str, <span class="comment">// ignored by equality and hashing operations
|
||
</span>}
|
||
|
||
<span class="kw">impl </span>PartialEq <span class="kw">for </span>S {
|
||
<span class="kw">fn </span>eq(<span class="kw-2">&</span><span class="self">self</span>, other: <span class="kw-2">&</span>S) -> bool {
|
||
<span class="self">self</span>.id == other.id
|
||
}
|
||
}
|
||
|
||
<span class="kw">impl </span>Eq <span class="kw">for </span>S {}
|
||
|
||
<span class="kw">impl </span>Hash <span class="kw">for </span>S {
|
||
<span class="kw">fn </span>hash<H: Hasher>(<span class="kw-2">&</span><span class="self">self</span>, state: <span class="kw-2">&mut </span>H) {
|
||
<span class="self">self</span>.id.hash(state);
|
||
}
|
||
}
|
||
|
||
<span class="kw">let </span>j_a = S { id: <span class="number">1</span>, name: <span class="string">"Jessica" </span>};
|
||
<span class="kw">let </span>j_b = S { id: <span class="number">1</span>, name: <span class="string">"Jess" </span>};
|
||
<span class="kw">let </span>p = S { id: <span class="number">2</span>, name: <span class="string">"Paul" </span>};
|
||
<span class="macro">assert_eq!</span>(j_a, j_b);
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>map = HashMap::new();
|
||
map.insert(j_a, <span class="string">"Paris"</span>);
|
||
<span class="macro">assert_eq!</span>(map.get_key_value(<span class="kw-2">&</span>j_a), <span class="prelude-val">Some</span>((<span class="kw-2">&</span>j_a, <span class="kw-2">&</span><span class="string">"Paris"</span>)));
|
||
<span class="macro">assert_eq!</span>(map.get_key_value(<span class="kw-2">&</span>j_b), <span class="prelude-val">Some</span>((<span class="kw-2">&</span>j_a, <span class="kw-2">&</span><span class="string">"Paris"</span>))); <span class="comment">// the notable case
|
||
</span><span class="macro">assert_eq!</span>(map.get_key_value(<span class="kw-2">&</span>p), <span class="prelude-val">None</span>);</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.contains_key" class="method"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.92.0/src/std/collections/hash/map.rs.html#1143-1146">Source</a></span><h4 class="code-header">pub fn <a href="#method.contains_key" class="fn">contains_key</a><Q>(&self, k: <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.reference.html">&Q</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.92.0/std/primitive.bool.html">bool</a><div class="where">where
|
||
K: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><Q>,
|
||
Q: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> + <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<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></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the map contains a value for the specified key.</p>
|
||
<p>The key may be any borrowed form of the map’s key type, but
|
||
<a href="https://doc.rust-lang.org/1.92.0/core/hash/trait.Hash.html" title="trait core::hash::Hash"><code>Hash</code></a> and <a href="https://doc.rust-lang.org/1.92.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq"><code>Eq</code></a> on the borrowed form <em>must</em> match those for
|
||
the key type.</p>
|
||
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::collections::HashMap;
|
||
|
||
<span class="kw">let </span><span class="kw-2">mut </span>map = HashMap::new();
|
||
map.insert(<span class="number">1</span>, <span class="string">"a"</span>);
|
||
<span class="macro">assert_eq!</span>(map.contains_key(<span class="kw-2">&</span><span class="number">1</span>), <span class="bool-val">true</span>);
|
||
<span class="macro">assert_eq!</span>(map.contains_key(<span class="kw-2">&</span><span class="number">2</span>), <span class="bool-val">false</span>);</code></pre></div></div></details></div></details><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-Networks" class="impl"><a class="src rightside" href="../src/sysinfo/debug.rs.html#110-121">Source</a><a href="#impl-Debug-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</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#111-120">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-Networks" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#1970-1974">Source</a><a href="#impl-Default-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</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#1971-1973">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>() -> Self</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><details class="toggle implementors-toggle" open><summary><section id="impl-Deref-for-Networks" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#2061-2067">Source</a><a href="#impl-Deref-for-Networks" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a> for <a class="struct" href="struct.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Target" class="associatedtype trait-impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#2062">Source</a><a href="#associatedtype.Target" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Deref.html#associatedtype.Target" class="associatedtype">Target</a> = <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="https://doc.rust-lang.org/1.92.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="struct.NetworkData.html" title="struct sysinfo::NetworkData">NetworkData</a>></h4></section></summary><div class='docblock'>The resulting type after dereferencing.</div></details><details class="toggle method-toggle" open><summary><section id="method.deref" class="method trait-impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#2064-2066">Source</a><a href="#method.deref" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Deref.html#tymethod.deref" class="fn">deref</a>(&self) -> &Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Deref.html#associatedtype.Target" title="type core::ops::deref::Deref::Target">Target</a></h4></section></summary><div class='docblock'>Dereferences the value.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoIterator-for-%26Networks" class="impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#1961-1968">Source</a><a href="#impl-IntoIterator-for-%26Networks" class="anchor">§</a><h3 class="code-header">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a> for &'a <a class="struct" href="struct.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Item" class="associatedtype trait-impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#1962">Source</a><a href="#associatedtype.Item" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.92.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" class="associatedtype">Item</a> = (&'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>, &'a <a class="struct" href="struct.NetworkData.html" title="struct sysinfo::NetworkData">NetworkData</a>)</h4></section></summary><div class='docblock'>The type of the elements being iterated over.</div></details><details class="toggle" open><summary><section id="associatedtype.IntoIter" class="associatedtype trait-impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#1963">Source</a><a href="#associatedtype.IntoIter" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.92.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" class="associatedtype">IntoIter</a> = <a class="struct" href="https://doc.rust-lang.org/1.92.0/std/collections/hash/map/struct.Iter.html" title="struct std::collections::hash::map::Iter">Iter</a><'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>, <a class="struct" href="struct.NetworkData.html" title="struct sysinfo::NetworkData">NetworkData</a>></h4></section></summary><div class='docblock'>Which kind of iterator are we turning this into?</div></details><details class="toggle method-toggle" open><summary><section id="method.into_iter" class="method trait-impl"><a class="src rightside" href="../src/sysinfo/common.rs.html#1965-1967">Source</a><a href="#method.into_iter" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.92.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter" class="fn">into_iter</a>(self) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.92.0/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.IntoIter" title="type core::iter::traits::collect::IntoIterator::IntoIter">IntoIter</a></h4></section></summary><div class='docblock'>Creates an iterator from a value. <a href="https://doc.rust-lang.org/1.92.0/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter">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-Networks" class="impl"><a href="#impl-Freeze-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section><section id="impl-RefUnwindSafe-for-Networks" class="impl"><a href="#impl-RefUnwindSafe-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section><section id="impl-Send-for-Networks" class="impl"><a href="#impl-Send-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section><section id="impl-Sync-for-Networks" class="impl"><a href="#impl-Sync-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section><section id="impl-Unpin-for-Networks" class="impl"><a href="#impl-Unpin-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</a></h3></section><section id="impl-UnwindSafe-for-Networks" class="impl"><a href="#impl-UnwindSafe-for-Networks" 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.Networks.html" title="struct sysinfo::Networks">Networks</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-1" class="method trait-impl"><a href="#method.deref-1" 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-Receiver-for-P" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/ops/deref.rs.html#378-380">Source</a><a href="#impl-Receiver-for-P" class="anchor">§</a><h3 class="code-header">impl<P, T> <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Receiver.html" title="trait core::ops::deref::Receiver">Receiver</a> for P<div class="where">where
|
||
P: <a class="trait" href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = 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>,
|
||
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" open><summary><section id="associatedtype.Target-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.92.0/src/core/ops/deref.rs.html#382">Source</a><a href="#associatedtype.Target-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.92.0/core/ops/deref/trait.Receiver.html#associatedtype.Target" class="associatedtype">Target</a> = T</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>arbitrary_self_types</code>)</span></div></span><div class='docblock'>The target type on which the method may be called.</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> |