blob: 9ed3163a46bb8bcd855b13b6896d5564d65b895b [file] [log] [blame]
<!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="A set of gRPC custom metadata entries."><meta name="keywords" content="rust, rustlang, rust-lang, MetadataMap"><title>MetadataMap in teaclave_rpc - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../teaclave_rpc/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../teaclave_rpc/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">MetadataMap</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.append">append</a></li><li><a href="#method.append_bin">append_bin</a></li><li><a href="#method.capacity">capacity</a></li><li><a href="#method.clear">clear</a></li><li><a href="#method.contains_key">contains_key</a></li><li><a href="#method.entry">entry</a></li><li><a href="#method.entry_bin">entry_bin</a></li><li><a href="#method.from_headers">from_headers</a></li><li><a href="#method.get">get</a></li><li><a href="#method.get_all">get_all</a></li><li><a href="#method.get_all_bin">get_all_bin</a></li><li><a href="#method.get_bin">get_bin</a></li><li><a href="#method.get_bin_mut">get_bin_mut</a></li><li><a href="#method.get_mut">get_mut</a></li><li><a href="#method.insert">insert</a></li><li><a href="#method.insert_bin">insert_bin</a></li><li><a href="#method.into_headers">into_headers</a></li><li><a href="#method.is_empty">is_empty</a></li><li><a href="#method.iter">iter</a></li><li><a href="#method.iter_mut">iter_mut</a></li><li><a href="#method.keys">keys</a></li><li><a href="#method.keys_len">keys_len</a></li><li><a href="#method.len">len</a></li><li><a href="#method.new">new</a></li><li><a href="#method.remove">remove</a></li><li><a href="#method.remove_bin">remove_bin</a></li><li><a href="#method.reserve">reserve</a></li><li><a href="#method.values">values</a></li><li><a href="#method.values_mut">values_mut</a></li><li><a href="#method.with_capacity">with_capacity</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-MetadataMap">Clone</a></li><li><a href="#impl-Debug-for-MetadataMap">Debug</a></li><li><a href="#impl-Default-for-MetadataMap">Default</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-MetadataMap">RefUnwindSafe</a></li><li><a href="#impl-Send-for-MetadataMap">Send</a></li><li><a href="#impl-Sync-for-MetadataMap">Sync</a></li><li><a href="#impl-Unpin-for-MetadataMap">Unpin</a></li><li><a href="#impl-UnwindSafe-for-MetadataMap">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-MetadataMap">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-MetadataMap">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-MetadataMap">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-MetadataMap">From&lt;T&gt;</a></li><li><a href="#impl-Instrument-for-MetadataMap">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-MetadataMap">Into&lt;U&gt;</a></li><li><a href="#impl-IntoRequest%3CT%3E-for-MetadataMap">IntoRequest&lt;T&gt;</a></li><li><a href="#impl-ToOwned-for-MetadataMap">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-MetadataMap">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-MetadataMap">TryInto&lt;U&gt;</a></li><li><a href="#impl-VZip%3CV%3E-for-MetadataMap">VZip&lt;V&gt;</a></li><li><a href="#impl-WithSubscriber-for-MetadataMap">WithSubscriber</a></li></ul></section><h2><a href="index.html">In teaclave_rpc</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="index.html">teaclave_rpc</a>::<wbr><a class="struct" href="#">MetadataMap</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/tonic/metadata/map.rs.html#35">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct MetadataMap { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A set of gRPC custom metadata entries.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<p>Basic usage</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;example.com&quot;</span>.parse().unwrap());
map.insert(<span class="string">&quot;x-number&quot;</span>, <span class="string">&quot;123&quot;</span>.parse().unwrap());
map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;[binary data]&quot;</span>));
<span class="macro">assert!</span>(map.contains_key(<span class="string">&quot;x-host&quot;</span>));
<span class="macro">assert!</span>(!map.contains_key(<span class="string">&quot;x-location&quot;</span>));
<span class="macro">assert_eq!</span>(map.get(<span class="string">&quot;x-host&quot;</span>).unwrap(), <span class="string">&quot;example.com&quot;</span>);
map.remove(<span class="string">&quot;x-host&quot;</span>);
<span class="macro">assert!</span>(!map.contains_key(<span class="string">&quot;x-host&quot;</span>));</code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#201">source</a><a href="#impl-MetadataMap" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#226">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -&gt; <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h4></section></summary><div class="docblock"><p>Create an empty <code>MetadataMap</code>.</p>
<p>The map will be created without any capacity. This function will not
allocate.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.is_empty());
<span class="macro">assert_eq!</span>(<span class="number">0</span>, map.capacity());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_headers" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#231">source</a><h4 class="code-header">pub fn <a href="#method.from_headers" class="fnname">from_headers</a>(headers: <a class="struct" href="../http/header/map/struct.HeaderMap.html" title="struct http::header::map::HeaderMap">HeaderMap</a>&lt;<a class="struct" href="../http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</a>&gt;) -&gt; <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h4></section></summary><div class="docblock"><p>Convert an HTTP HeaderMap to a MetadataMap</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_headers" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#248">source</a><h4 class="code-header">pub fn <a href="#method.into_headers" class="fnname">into_headers</a>(self) -&gt; <a class="struct" href="../http/header/map/struct.HeaderMap.html" title="struct http::header::map::HeaderMap">HeaderMap</a>&lt;<a class="struct" href="../http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</a>&gt;</h4></section></summary><div class="docblock"><p>Convert a MetadataMap into a HTTP HeaderMap</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;example.com&quot;</span>.parse().unwrap());
<span class="kw">let </span>http_map = map.into_headers();
<span class="macro">assert_eq!</span>(http_map.get(<span class="string">&quot;x-host&quot;</span>).unwrap(), <span class="string">&quot;example.com&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_capacity" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#277">source</a><h4 class="code-header">pub fn <a href="#method.with_capacity" class="fnname">with_capacity</a>(capacity: usize) -&gt; <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h4></section></summary><div class="docblock"><p>Create an empty <code>MetadataMap</code> with the specified capacity.</p>
<p>The returned map will allocate internal storage in order to hold about
<code>capacity</code> elements without reallocating. However, this is a “best
effort” as there are usage patterns that could cause additional
allocations before <code>capacity</code> metadata entries are stored in the map.</p>
<p>More capacity than requested may be allocated.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>map: MetadataMap = MetadataMap::with_capacity(<span class="number">10</span>);
<span class="macro">assert!</span>(map.is_empty());
<span class="macro">assert!</span>(map.capacity() &gt;= <span class="number">10</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.len" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#307">source</a><h4 class="code-header">pub fn <a href="#method.len" class="fnname">len</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of metadata entries (ascii and binary) stored in the
map.</p>
<p>This number represents the total number of <strong>values</strong> stored in the map.
This number can be greater than or equal to the number of <strong>keys</strong>
stored given that a single key may have more than one associated value.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert_eq!</span>(<span class="number">0</span>, map.len());
map.insert(<span class="string">&quot;x-host-ip&quot;</span>, <span class="string">&quot;127.0.0.1&quot;</span>.parse().unwrap());
map.insert_bin(<span class="string">&quot;x-host-name-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;localhost&quot;</span>));
<span class="macro">assert_eq!</span>(<span class="number">2</span>, map.len());
map.append(<span class="string">&quot;x-host-ip&quot;</span>, <span class="string">&quot;text/html&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(<span class="number">3</span>, map.len());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.keys_len" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#333">source</a><h4 class="code-header">pub fn <a href="#method.keys_len" class="fnname">keys_len</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of keys (ascii and binary) stored in the map.</p>
<p>This number will be less than or equal to <code>len()</code> as each key may have
more than one associated value.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert_eq!</span>(<span class="number">0</span>, map.keys_len());
map.insert(<span class="string">&quot;x-host-ip&quot;</span>, <span class="string">&quot;127.0.0.1&quot;</span>.parse().unwrap());
map.insert_bin(<span class="string">&quot;x-host-name-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;localhost&quot;</span>));
<span class="macro">assert_eq!</span>(<span class="number">2</span>, map.keys_len());
map.append(<span class="string">&quot;x-host-ip&quot;</span>, <span class="string">&quot;text/html&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(<span class="number">2</span>, map.keys_len());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_empty" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#351">source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fnname">is_empty</a>(&amp;self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns true if the map contains no elements.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.is_empty());
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello.world&quot;</span>.parse().unwrap());
<span class="macro">assert!</span>(!map.is_empty());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clear" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#369">source</a><h4 class="code-header">pub fn <a href="#method.clear" class="fnname">clear</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Clears the map, removing all key-value pairs. Keeps the allocated memory
for reuse.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello.world&quot;</span>.parse().unwrap());
map.clear();
<span class="macro">assert!</span>(map.is_empty());
<span class="macro">assert!</span>(map.capacity() &gt; <span class="number">0</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.capacity" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#390">source</a><h4 class="code-header">pub fn <a href="#method.capacity" class="fnname">capacity</a>(&amp;self) -&gt; usize</h4></section></summary><div class="docblock"><p>Returns the number of custom metadata entries the map can hold without
reallocating.</p>
<p>This number is an approximation as certain usage patterns could cause
additional allocations before the returned capacity is filled.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert_eq!</span>(<span class="number">0</span>, map.capacity());
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello.world&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(<span class="number">6</span>, map.capacity());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.reserve" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#415">source</a><h4 class="code-header">pub fn <a href="#method.reserve" class="fnname">reserve</a>(&amp;mut self, additional: usize)</h4></section></summary><div class="docblock"><p>Reserves capacity for at least <code>additional</code> more custom metadata to be
inserted into the <code>MetadataMap</code>.</p>
<p>The metadata map may reserve more space to avoid frequent reallocations.
Like with <code>with_capacity</code>, this will be a “best effort” to avoid
allocations until <code>additional</code> more custom metadata is inserted. Certain
usage patterns could cause additional allocations before the number is
reached.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if the new allocation size overflows <code>usize</code>.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.reserve(<span class="number">10</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#454-456">source</a><h4 class="code-header">pub fn <a href="#method.get" class="fnname">get</a>&lt;K&gt;(&amp;self, key: K) -&gt; Option&lt;&amp;<a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Ascii&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Returns a reference to the value associated with the key. This method
is for ascii metadata entries (those whose names don’t end with
“-bin”). For binary entries, use get_bin.</p>
<p>If there are multiple values associated with the key, then the first one
is returned. Use <code>get_all</code> to get all values associated with a given
key. Returns <code>None</code> if there are no values associated with the key.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.get(<span class="string">&quot;x-host&quot;</span>).is_none());
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(map.get(<span class="string">&quot;x-host&quot;</span>).unwrap(), <span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>);
<span class="macro">assert_eq!</span>(map.get(<span class="string">&quot;x-host&quot;</span>).unwrap(), <span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>);
map.append(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(map.get(<span class="string">&quot;x-host&quot;</span>).unwrap(), <span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>);
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append_bin(<span class="string">&quot;host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
<span class="macro">assert!</span>(map.get(<span class="string">&quot;host-bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get(<span class="string">&quot;host-bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get(<span class="kw-2">&amp;</span>(<span class="string">&quot;host-bin&quot;</span>.to_string())).is_none());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.get(<span class="string">&quot;host{}bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get(<span class="string">&quot;host{}bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}bin&quot;</span>.to_string())).is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_bin" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#490-492">source</a><h4 class="code-header">pub fn <a href="#method.get_bin" class="fnname">get_bin</a>&lt;K&gt;(&amp;self, key: K) -&gt; Option&lt;&amp;<a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Binary&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Like get, but for Binary keys (for example “trace-proto-bin”).</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.get_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).is_none());
map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;hello&quot;</span>));
<span class="macro">assert_eq!</span>(map.get_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).unwrap(), <span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>);
<span class="macro">assert_eq!</span>(map.get_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).unwrap(), <span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>);
map.append_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
<span class="macro">assert_eq!</span>(map.get_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).unwrap(), <span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>);
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append(<span class="string">&quot;host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="macro">assert!</span>(map.get_bin(<span class="string">&quot;host&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get_bin(<span class="string">&quot;host&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host&quot;</span>.to_string())).is_none());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.get_bin(<span class="string">&quot;host{}-bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get_bin(<span class="string">&quot;host{}-bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}-bin&quot;</span>.to_string())).is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_mut" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#528-530">source</a><h4 class="code-header">pub fn <a href="#method.get_mut" class="fnname">get_mut</a>&lt;K&gt;(&amp;mut self, key: K) -&gt; Option&lt;&amp;mut <a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Ascii&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Returns a mutable reference to the value associated with the key. This
method is for ascii metadata entries (those whose names don’t end with
“-bin”). For binary entries, use get_mut_bin.</p>
<p>If there are multiple values associated with the key, then the first one
is returned. Use <code>entry</code> to get all values associated with a given
key. Returns <code>None</code> if there are no values associated with the key.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::default();
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.get_mut(<span class="string">&quot;x-host&quot;</span>).unwrap().set_sensitive(<span class="bool-val">true</span>);
<span class="macro">assert!</span>(map.get(<span class="string">&quot;x-host&quot;</span>).unwrap().is_sensitive());
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append_bin(<span class="string">&quot;host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
<span class="macro">assert!</span>(map.get_mut(<span class="string">&quot;host-bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get_mut(<span class="string">&quot;host-bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get_mut(<span class="kw-2">&amp;</span>(<span class="string">&quot;host-bin&quot;</span>.to_string())).is_none());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.get_mut(<span class="string">&quot;host{}&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get_mut(<span class="string">&quot;host{}&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get_mut(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}&quot;</span>.to_string())).is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_bin_mut" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#560-562">source</a><h4 class="code-header">pub fn <a href="#method.get_bin_mut" class="fnname">get_bin_mut</a>&lt;K&gt;(&amp;mut self, key: K) -&gt; Option&lt;&amp;mut <a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Binary&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Like get_mut, but for Binary keys (for example “trace-proto-bin”).</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::default();
map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;hello&quot;</span>));
map.get_bin_mut(<span class="string">&quot;trace-proto-bin&quot;</span>).unwrap().set_sensitive(<span class="bool-val">true</span>);
<span class="macro">assert!</span>(map.get_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).unwrap().is_sensitive());
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append(<span class="string">&quot;host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="macro">assert!</span>(map.get_bin_mut(<span class="string">&quot;host&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get_bin_mut(<span class="string">&quot;host&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get_bin_mut(<span class="kw-2">&amp;</span>(<span class="string">&quot;host&quot;</span>.to_string())).is_none());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.get_bin_mut(<span class="string">&quot;host{}-bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.get_bin_mut(<span class="string">&quot;host{}-bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.get_bin_mut(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}-bin&quot;</span>.to_string())).is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_all" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#608-610">source</a><h4 class="code-header">pub fn <a href="#method.get_all" class="fnname">get_all</a>&lt;K&gt;(&amp;self, key: K) -&gt; <a class="struct" href="../tonic/metadata/map/struct.GetAll.html" title="struct tonic::metadata::map::GetAll">GetAll</a>&lt;'_, Ascii&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Returns a view of all values associated with a key. This method is for
ascii metadata entries (those whose names don’t end with “-bin”). For
binary entries, use get_all_bin.</p>
<p>The returned view does not incur any allocations and allows iterating
the values associated with the key. See <a href="struct.GetAll.html"><code>GetAll</code></a> for more details.
Returns <code>None</code> if there are no values associated with the key.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.append(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;goodbye&quot;</span>.parse().unwrap());
{
<span class="kw">let </span>view = map.get_all(<span class="string">&quot;x-host&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>iter = view.iter();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>, iter.next().unwrap());
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="string">&quot;goodbye&quot;</span>, iter.next().unwrap());
<span class="macro">assert!</span>(iter.next().is_none());
}
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append_bin(<span class="string">&quot;host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
<span class="macro">assert!</span>(map.get_all(<span class="string">&quot;host-bin&quot;</span>).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all(<span class="string">&quot;host-bin&quot;</span>.to_string()).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all(<span class="kw-2">&amp;</span>(<span class="string">&quot;host-bin&quot;</span>.to_string())).iter().next().is_none());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.get_all(<span class="string">&quot;host{}&quot;</span>).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all(<span class="string">&quot;host{}&quot;</span>.to_string()).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}&quot;</span>.to_string())).iter().next().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_all_bin" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#651-653">source</a><h4 class="code-header">pub fn <a href="#method.get_all_bin" class="fnname">get_all_bin</a>&lt;K&gt;(&amp;self, key: K) -&gt; <a class="struct" href="../tonic/metadata/map/struct.GetAll.html" title="struct tonic::metadata::map::GetAll">GetAll</a>&lt;'_, Binary&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Like get_all, but for Binary keys (for example “trace-proto-bin”).</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;hello&quot;</span>));
map.append_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;goodbye&quot;</span>));
{
<span class="kw">let </span>view = map.get_all_bin(<span class="string">&quot;trace-proto-bin&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>iter = view.iter();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="string">&quot;hello&quot;</span>, iter.next().unwrap());
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="string">&quot;goodbye&quot;</span>, iter.next().unwrap());
<span class="macro">assert!</span>(iter.next().is_none());
}
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append(<span class="string">&quot;host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="macro">assert!</span>(map.get_all_bin(<span class="string">&quot;host&quot;</span>).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all_bin(<span class="string">&quot;host&quot;</span>.to_string()).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host&quot;</span>.to_string())).iter().next().is_none());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.get_all_bin(<span class="string">&quot;host{}-bin&quot;</span>).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all_bin(<span class="string">&quot;host{}-bin&quot;</span>.to_string()).iter().next().is_none());
<span class="macro">assert!</span>(map.get_all_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}-bin&quot;</span>.to_string())).iter().next().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.contains_key" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#681-683">source</a><h4 class="code-header">pub fn <a href="#method.contains_key" class="fnname">contains_key</a>&lt;K&gt;(&amp;self, key: K) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsEncodingAgnosticMetadataKey,</span></h4></section></summary><div class="docblock"><p>Returns true if the map contains a value for the specified key. This
method works for both ascii and binary entries.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(!map.contains_key(<span class="string">&quot;x-host&quot;</span>));
map.append_bin(<span class="string">&quot;host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="comment">// contains_key works for both Binary and Ascii keys:
</span><span class="macro">assert!</span>(map.contains_key(<span class="string">&quot;x-host&quot;</span>));
<span class="macro">assert!</span>(map.contains_key(<span class="string">&quot;host-bin&quot;</span>));
<span class="comment">// contains_key returns false for invalid keys:
</span><span class="macro">assert!</span>(!map.contains_key(<span class="string">&quot;x{}host&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.iter" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#713">source</a><h4 class="code-header">pub fn <a href="#method.iter" class="fnname">iter</a>(&amp;self) -&gt; <a class="struct" href="../tonic/metadata/map/struct.Iter.html" title="struct tonic::metadata::map::Iter">Iter</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>An iterator visiting all key-value pairs (both ascii and binary).</p>
<p>The iteration order is arbitrary, but consistent across platforms for
the same crate version. Each key will be yielded once per associated
value. So, if a key has 3 associated values, it will be yielded 3 times.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.append(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;goodbye&quot;</span>.parse().unwrap());
map.insert(<span class="string">&quot;x-number&quot;</span>, <span class="string">&quot;123&quot;</span>.parse().unwrap());
<span class="kw">for </span>key_and_value <span class="kw">in </span>map.iter() {
<span class="kw">match </span>key_and_value {
KeyAndValueRef::Ascii(<span class="kw-2">ref </span>key, <span class="kw-2">ref </span>value) =&gt;
<span class="macro">println!</span>(<span class="string">&quot;Ascii: {:?}: {:?}&quot;</span>, key, value),
KeyAndValueRef::Binary(<span class="kw-2">ref </span>key, <span class="kw-2">ref </span>value) =&gt;
<span class="macro">println!</span>(<span class="string">&quot;Binary: {:?}: {:?}&quot;</span>, key, value),
}
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.iter_mut" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#744">source</a><h4 class="code-header">pub fn <a href="#method.iter_mut" class="fnname">iter_mut</a>(&amp;mut self) -&gt; <a class="struct" href="../tonic/metadata/map/struct.IterMut.html" title="struct tonic::metadata::map::IterMut">IterMut</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>An iterator visiting all key-value pairs, with mutable value references.</p>
<p>The iterator order is arbitrary, but consistent across platforms for the
same crate version. Each key will be yielded once per associated value,
so if a key has 3 associated values, it will be yielded 3 times.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.append(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;goodbye&quot;</span>.parse().unwrap());
map.insert(<span class="string">&quot;x-number&quot;</span>, <span class="string">&quot;123&quot;</span>.parse().unwrap());
<span class="kw">for </span>key_and_value <span class="kw">in </span>map.iter_mut() {
<span class="kw">match </span>key_and_value {
KeyAndMutValueRef::Ascii(key, <span class="kw-2">mut </span>value) =&gt;
value.set_sensitive(<span class="bool-val">true</span>),
KeyAndMutValueRef::Binary(key, <span class="kw-2">mut </span>value) =&gt;
value.set_sensitive(<span class="bool-val">false</span>),
}
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.keys" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#776">source</a><h4 class="code-header">pub fn <a href="#method.keys" class="fnname">keys</a>(&amp;self) -&gt; <a class="struct" href="../tonic/metadata/map/struct.Keys.html" title="struct tonic::metadata::map::Keys">Keys</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>An iterator visiting all keys.</p>
<p>The iteration order is arbitrary, but consistent across platforms for
the same crate version. Each key will be yielded only once even if it
has multiple associated values.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.append(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;goodbye&quot;</span>.parse().unwrap());
map.insert_bin(<span class="string">&quot;x-number-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;123&quot;</span>));
<span class="kw">for </span>key <span class="kw">in </span>map.keys() {
<span class="kw">match </span>key {
KeyRef::Ascii(<span class="kw-2">ref </span>key) =&gt;
<span class="macro">println!</span>(<span class="string">&quot;Ascii key: {:?}&quot;</span>, key),
KeyRef::Binary(<span class="kw-2">ref </span>key) =&gt;
<span class="macro">println!</span>(<span class="string">&quot;Binary key: {:?}&quot;</span>, key),
}
<span class="macro">println!</span>(<span class="string">&quot;{:?}&quot;</span>, key);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.values" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#807">source</a><h4 class="code-header">pub fn <a href="#method.values" class="fnname">values</a>(&amp;self) -&gt; <a class="struct" href="../tonic/metadata/map/struct.Values.html" title="struct tonic::metadata::map::Values">Values</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>An iterator visiting all values (both ascii and binary).</p>
<p>The iteration order is arbitrary, but consistent across platforms for
the same crate version.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.append(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;goodbye&quot;</span>.parse().unwrap());
map.insert_bin(<span class="string">&quot;x-number-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;123&quot;</span>));
<span class="kw">for </span>value <span class="kw">in </span>map.values() {
<span class="kw">match </span>value {
ValueRef::Ascii(<span class="kw-2">ref </span>value) =&gt;
<span class="macro">println!</span>(<span class="string">&quot;Ascii value: {:?}&quot;</span>, value),
ValueRef::Binary(<span class="kw-2">ref </span>value) =&gt;
<span class="macro">println!</span>(<span class="string">&quot;Binary value: {:?}&quot;</span>, value),
}
<span class="macro">println!</span>(<span class="string">&quot;{:?}&quot;</span>, value);
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.values_mut" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#837">source</a><h4 class="code-header">pub fn <a href="#method.values_mut" class="fnname">values_mut</a>(&amp;mut self) -&gt; <a class="struct" href="../tonic/metadata/map/struct.ValuesMut.html" title="struct tonic::metadata::map::ValuesMut">ValuesMut</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>An iterator visiting all values mutably.</p>
<p>The iteration order is arbitrary, but consistent across platforms for
the same crate version.</p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::default();
map.insert(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;hello&quot;</span>.parse().unwrap());
map.append(<span class="string">&quot;x-word&quot;</span>, <span class="string">&quot;goodbye&quot;</span>.parse().unwrap());
map.insert(<span class="string">&quot;x-number&quot;</span>, <span class="string">&quot;123&quot;</span>.parse().unwrap());
<span class="kw">for </span>value <span class="kw">in </span>map.values_mut() {
<span class="kw">match </span>value {
ValueRefMut::Ascii(<span class="kw-2">mut </span>value) =&gt;
value.set_sensitive(<span class="bool-val">true</span>),
ValueRefMut::Binary(<span class="kw-2">mut </span>value) =&gt;
value.set_sensitive(<span class="bool-val">false</span>),
}
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.entry" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#883-885">source</a><h4 class="code-header">pub fn <a href="#method.entry" class="fnname">entry</a>&lt;K&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self,<br>&nbsp;&nbsp;&nbsp;&nbsp;key: K<br>) -&gt; Result&lt;<a class="enum" href="../tonic/metadata/map/enum.Entry.html" title="enum tonic::metadata::map::Entry">Entry</a>&lt;'_, Ascii&gt;, <a class="struct" href="../tonic/metadata/key/struct.InvalidMetadataKey.html" title="struct tonic::metadata::key::InvalidMetadataKey">InvalidMetadataKey</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Gets the given ascii key’s corresponding entry in the map for in-place
manipulation. For binary keys, use <code>entry_bin</code>.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::default();
<span class="kw">let </span>headers = <span class="kw-2">&amp;</span>[
<span class="string">&quot;content-length&quot;</span>,
<span class="string">&quot;x-hello&quot;</span>,
<span class="string">&quot;Content-Length&quot;</span>,
<span class="string">&quot;x-world&quot;</span>,
];
<span class="kw">for </span><span class="kw-2">&amp;</span>header <span class="kw">in </span>headers {
<span class="kw">let </span>counter = map.entry(header).unwrap().or_insert(<span class="string">&quot;&quot;</span>.parse().unwrap());
<span class="kw-2">*</span>counter = <span class="macro">format!</span>(<span class="string">&quot;{}{}&quot;</span>, counter.to_str().unwrap(), <span class="string">&quot;1&quot;</span>).parse().unwrap();
}
<span class="macro">assert_eq!</span>(map.get(<span class="string">&quot;content-length&quot;</span>).unwrap(), <span class="string">&quot;11&quot;</span>);
<span class="macro">assert_eq!</span>(map.get(<span class="string">&quot;x-hello&quot;</span>).unwrap(), <span class="string">&quot;1&quot;</span>);
<span class="comment">// Gracefully handles parting invalid key strings
</span><span class="macro">assert!</span>(!map.entry(<span class="string">&quot;a{}b&quot;</span>).is_ok());
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append_bin(<span class="string">&quot;host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
<span class="macro">assert!</span>(!map.entry(<span class="string">&quot;host-bin&quot;</span>).is_ok());
<span class="macro">assert!</span>(!map.entry(<span class="string">&quot;host-bin&quot;</span>.to_string()).is_ok());
<span class="macro">assert!</span>(!map.entry(<span class="kw-2">&amp;</span>(<span class="string">&quot;host-bin&quot;</span>.to_string())).is_ok());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(!map.entry(<span class="string">&quot;host{}&quot;</span>).is_ok());
<span class="macro">assert!</span>(!map.entry(<span class="string">&quot;host{}&quot;</span>.to_string()).is_ok());
<span class="macro">assert!</span>(!map.entry(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}&quot;</span>.to_string())).is_ok());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.entry_bin" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#928-930">source</a><h4 class="code-header">pub fn <a href="#method.entry_bin" class="fnname">entry_bin</a>&lt;K&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self,<br>&nbsp;&nbsp;&nbsp;&nbsp;key: K<br>) -&gt; Result&lt;<a class="enum" href="../tonic/metadata/map/enum.Entry.html" title="enum tonic::metadata::map::Entry">Entry</a>&lt;'_, Binary&gt;, <a class="struct" href="../tonic/metadata/key/struct.InvalidMetadataKey.html" title="struct tonic::metadata::key::InvalidMetadataKey">InvalidMetadataKey</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Gets the given Binary key’s corresponding entry in the map for in-place
manipulation.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::default();
<span class="kw">let </span>headers = <span class="kw-2">&amp;</span>[
<span class="string">&quot;content-length-bin&quot;</span>,
<span class="string">&quot;x-hello-bin&quot;</span>,
<span class="string">&quot;Content-Length-bin&quot;</span>,
<span class="string">&quot;x-world-bin&quot;</span>,
];
<span class="kw">for </span><span class="kw-2">&amp;</span>header <span class="kw">in </span>headers {
<span class="kw">let </span>counter = map.entry_bin(header).unwrap().or_insert(MetadataValue::from_bytes(<span class="string">b&quot;&quot;</span>));
<span class="kw-2">*</span>counter = MetadataValue::from_bytes(<span class="macro">format!</span>(<span class="string">&quot;{}{}&quot;</span>, str::from_utf8(counter.to_bytes().unwrap().as_ref()).unwrap(), <span class="string">&quot;1&quot;</span>).as_bytes());
}
<span class="macro">assert_eq!</span>(map.get_bin(<span class="string">&quot;content-length-bin&quot;</span>).unwrap(), <span class="string">&quot;11&quot;</span>);
<span class="macro">assert_eq!</span>(map.get_bin(<span class="string">&quot;x-hello-bin&quot;</span>).unwrap(), <span class="string">&quot;1&quot;</span>);
<span class="comment">// Attempting to read a key of the wrong type fails by not
// finding anything.
</span>map.append(<span class="string">&quot;host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="macro">assert!</span>(!map.entry_bin(<span class="string">&quot;host&quot;</span>).is_ok());
<span class="macro">assert!</span>(!map.entry_bin(<span class="string">&quot;host&quot;</span>.to_string()).is_ok());
<span class="macro">assert!</span>(!map.entry_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host&quot;</span>.to_string())).is_ok());
<span class="comment">// Attempting to read an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(!map.entry_bin(<span class="string">&quot;host{}-bin&quot;</span>).is_ok());
<span class="macro">assert!</span>(!map.entry_bin(<span class="string">&quot;host{}-bin&quot;</span>.to_string()).is_ok());
<span class="macro">assert!</span>(!map.entry_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}-bin&quot;</span>.to_string())).is_ok());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.insert" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#1001-1003">source</a><h4 class="code-header">pub fn <a href="#method.insert" class="fnname">insert</a>&lt;K&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self,<br>&nbsp;&nbsp;&nbsp;&nbsp;key: K,<br>&nbsp;&nbsp;&nbsp;&nbsp;val: <a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Ascii&gt;<br>) -&gt; Option&lt;<a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Ascii&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: IntoMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Inserts an ascii key-value pair into the map. To insert a binary entry,
use <code>insert_bin</code>.</p>
<p>This method panics when the given key is a string and it cannot be
converted to a MetadataKey<Ascii>.</p>
<p>If the map did not previously have this key present, then <code>None</code> is
returned.</p>
<p>If the map did have this key present, the new value is associated with
the key and all previous values are removed. <strong>Note</strong> that only a single
one of the previous values is returned. If there are multiple values
that have been previously associated with the key, then the first one is
returned. See <code>insert_mult</code> on <code>OccupiedEntry</code> for an API that returns
all values.</p>
<p>The key is not updated, though; this matters for types that can be <code>==</code>
without being identical.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap()).is_none());
<span class="macro">assert!</span>(!map.is_empty());
<span class="kw">let </span><span class="kw-2">mut </span>prev = map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;earth&quot;</span>.parse().unwrap()).unwrap();
<span class="macro">assert_eq!</span>(<span class="string">&quot;world&quot;</span>, prev);</code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to insert a key that is not valid panics.
</span>map.insert(<span class="string">&quot;x{}host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());</code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to insert a key that is binary panics (use insert_bin).
</span>map.insert(<span class="string">&quot;x-host-bin&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.insert_bin" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#1038-1044">source</a><h4 class="code-header">pub fn <a href="#method.insert_bin" class="fnname">insert_bin</a>&lt;K&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self,<br>&nbsp;&nbsp;&nbsp;&nbsp;key: K,<br>&nbsp;&nbsp;&nbsp;&nbsp;val: <a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Binary&gt;<br>) -&gt; Option&lt;<a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Binary&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: IntoMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Like insert, but for Binary keys (for example “trace-proto-bin”).</p>
<p>This method panics when the given key is a string and it cannot be
converted to a MetadataKey<Binary>.</p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>)).is_none());
<span class="macro">assert!</span>(!map.is_empty());
<span class="kw">let </span><span class="kw-2">mut </span>prev = map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;earth&quot;</span>)).unwrap();
<span class="macro">assert_eq!</span>(<span class="string">&quot;world&quot;</span>, prev);</code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::default();
<span class="comment">// Attempting to add a binary metadata entry with an invalid name
</span>map.insert_bin(<span class="string">&quot;trace-proto&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;hello&quot;</span>)); <span class="comment">// This line panics!</span></code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to insert a key that is not valid panics.
</span>map.insert_bin(<span class="string">&quot;x{}host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>)); <span class="comment">// This line panics!</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.append" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#1092-1094">source</a><h4 class="code-header">pub fn <a href="#method.append" class="fnname">append</a>&lt;K&gt;(&amp;mut self, key: K, value: <a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Ascii&gt;) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: IntoMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Inserts an ascii key-value pair into the map. To insert a binary entry,
use <code>append_bin</code>.</p>
<p>This method panics when the given key is a string and it cannot be
converted to a MetadataKey<Ascii>.</p>
<p>If the map did not previously have this key present, then <code>false</code> is
returned.</p>
<p>If the map did have this key present, the new value is pushed to the end
of the list of values currently associated with the key. The key is not
updated, though; this matters for types that can be <code>==</code> without being
identical.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap()).is_none());
<span class="macro">assert!</span>(!map.is_empty());
map.append(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;earth&quot;</span>.parse().unwrap());
<span class="kw">let </span>values = map.get_all(<span class="string">&quot;x-host&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>i = values.iter();
<span class="macro">assert_eq!</span>(<span class="string">&quot;world&quot;</span>, <span class="kw-2">*</span>i.next().unwrap());
<span class="macro">assert_eq!</span>(<span class="string">&quot;earth&quot;</span>, <span class="kw-2">*</span>i.next().unwrap());</code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to append a key that is not valid panics.
</span>map.append(<span class="string">&quot;x{}host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap()); <span class="comment">// This line panics!</span></code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to append a key that is binary panics (use append_bin).
</span>map.append(<span class="string">&quot;x-host-bin&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap()); <span class="comment">// This line panics!</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.append_bin" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#1133-1135">source</a><h4 class="code-header">pub fn <a href="#method.append_bin" class="fnname">append_bin</a>&lt;K&gt;(&amp;mut self, key: K, value: <a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Binary&gt;) -&gt; bool<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: IntoMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Like append, but for binary keys (for example “trace-proto-bin”).</p>
<p>This method panics when the given key is a string and it cannot be
converted to a MetadataKey<Binary>.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="macro">assert!</span>(map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>)).is_none());
<span class="macro">assert!</span>(!map.is_empty());
map.append_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;earth&quot;</span>));
<span class="kw">let </span>values = map.get_all_bin(<span class="string">&quot;trace-proto-bin&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>i = values.iter();
<span class="macro">assert_eq!</span>(<span class="string">&quot;world&quot;</span>, <span class="kw-2">*</span>i.next().unwrap());
<span class="macro">assert_eq!</span>(<span class="string">&quot;earth&quot;</span>, <span class="kw-2">*</span>i.next().unwrap());</code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to append a key that is not valid panics.
</span>map.append_bin(<span class="string">&quot;x{}host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>)); <span class="comment">// This line panics!</span></code></pre></div>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
<span class="comment">// Trying to append a key that is ascii panics (use append).
</span>map.append_bin(<span class="string">&quot;x-host&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>)); <span class="comment">// This line panics!</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.remove" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#1173-1175">source</a><h4 class="code-header">pub fn <a href="#method.remove" class="fnname">remove</a>&lt;K&gt;(&amp;mut self, key: K) -&gt; Option&lt;<a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Ascii&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Ascii&gt;,</span></h4></section></summary><div class="docblock"><p>Removes an ascii key from the map, returning the value associated with
the key. To remove a binary key, use <code>remove_bin</code>.</p>
<p>Returns <code>None</code> if the map does not contain the key. If there are
multiple values associated with the key, then the first one is returned.
See <code>remove_entry_mult</code> on <code>OccupiedEntry</code> for an API that yields all
values.</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert(<span class="string">&quot;x-host&quot;</span>, <span class="string">&quot;hello.world&quot;</span>.parse().unwrap());
<span class="kw">let </span>prev = map.remove(<span class="string">&quot;x-host&quot;</span>).unwrap();
<span class="macro">assert_eq!</span>(<span class="string">&quot;hello.world&quot;</span>, prev);
<span class="macro">assert!</span>(map.remove(<span class="string">&quot;x-host&quot;</span>).is_none());
<span class="comment">// Attempting to remove a key of the wrong type fails by not
// finding anything.
</span>map.append_bin(<span class="string">&quot;host-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;world&quot;</span>));
<span class="macro">assert!</span>(map.remove(<span class="string">&quot;host-bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.remove(<span class="string">&quot;host-bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.remove(<span class="kw-2">&amp;</span>(<span class="string">&quot;host-bin&quot;</span>.to_string())).is_none());
<span class="comment">// Attempting to remove an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.remove(<span class="string">&quot;host{}&quot;</span>).is_none());
<span class="macro">assert!</span>(map.remove(<span class="string">&quot;host{}&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.remove(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}&quot;</span>.to_string())).is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.remove_bin" class="method has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#1207-1209">source</a><h4 class="code-header">pub fn <a href="#method.remove_bin" class="fnname">remove_bin</a>&lt;K&gt;(&amp;mut self, key: K) -&gt; Option&lt;<a class="struct" href="../tonic/metadata/value/struct.MetadataValue.html" title="struct tonic::metadata::value::MetadataValue">MetadataValue</a>&lt;Binary&gt;&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;K: AsMetadataKey&lt;Binary&gt;,</span></h4></section></summary><div class="docblock"><p>Like remove, but for Binary keys (for example “trace-proto-bin”).</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>map = MetadataMap::new();
map.insert_bin(<span class="string">&quot;trace-proto-bin&quot;</span>, MetadataValue::from_bytes(<span class="string">b&quot;hello.world&quot;</span>));
<span class="kw">let </span>prev = map.remove_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).unwrap();
<span class="macro">assert_eq!</span>(<span class="string">&quot;hello.world&quot;</span>, prev);
<span class="macro">assert!</span>(map.remove_bin(<span class="string">&quot;trace-proto-bin&quot;</span>).is_none());
<span class="comment">// Attempting to remove a key of the wrong type fails by not
// finding anything.
</span>map.append(<span class="string">&quot;host&quot;</span>, <span class="string">&quot;world&quot;</span>.parse().unwrap());
<span class="macro">assert!</span>(map.remove_bin(<span class="string">&quot;host&quot;</span>).is_none());
<span class="macro">assert!</span>(map.remove_bin(<span class="string">&quot;host&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.remove_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host&quot;</span>.to_string())).is_none());
<span class="comment">// Attempting to remove an invalid key string fails by not
// finding anything.
</span><span class="macro">assert!</span>(map.remove_bin(<span class="string">&quot;host{}-bin&quot;</span>).is_none());
<span class="macro">assert!</span>(map.remove_bin(<span class="string">&quot;host{}-bin&quot;</span>.to_string()).is_none());
<span class="macro">assert!</span>(map.remove_bin(<span class="kw-2">&amp;</span>(<span class="string">&quot;host{}-bin&quot;</span>.to_string())).is_none());</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#34">source</a><a href="#impl-Clone-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl Clone for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#34">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&amp;mut self, source: &amp;Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#34">source</a><a href="#impl-Debug-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl Debug for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#34">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&amp;self, f: &amp;mut Formatter&lt;'_&gt;) -&gt; Result&lt;(), Error&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Default-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#34">source</a><a href="#impl-Default-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl Default for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tonic/metadata/map.rs.html#34">source</a><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a class="fnname">default</a>() -&gt; <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a>Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-MetadataMap" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section><section id="impl-Send-for-MetadataMap" class="impl has-srclink"><a href="#impl-Send-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl Send for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section><section id="impl-Sync-for-MetadataMap" class="impl has-srclink"><a href="#impl-Sync-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl Sync for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section><section id="impl-Unpin-for-MetadataMap" class="impl has-srclink"><a href="#impl-Unpin-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section><section id="impl-UnwindSafe-for-MetadataMap" class="impl has-srclink"><a href="#impl-UnwindSafe-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="struct.MetadataMap.html" title="struct teaclave_rpc::MetadataMap">MetadataMap</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-MetadataMap" class="impl has-srclink"><a href="#impl-Any-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Any for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&amp;self) -&gt; TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-MetadataMap" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; Borrow&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&amp;self) -&gt; &amp;T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-MetadataMap" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; BorrowMut&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?Sized,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&amp;mut self) -&gt; &amp;mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-MetadataMap" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; From&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Instrument-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#276">source</a><a href="#impl-Instrument-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#82">source</a><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="../tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -&gt; <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the provided <a href="../tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="../tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#121">source</a><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -&gt; <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the <a href="../tracing/span/struct.Span.html#method.current">current</a> <a href="../tracing/span/struct.Span.html"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="../tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-MetadataMap" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; Into&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: From&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -&gt; 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>[From]&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-IntoRequest%3CT%3E-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tonic/request.rs.html#346">source</a><a href="#impl-IntoRequest%3CT%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.IntoRequest.html" title="trait teaclave_rpc::IntoRequest">IntoRequest</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_request" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tonic/request.rs.html#347">source</a><a href="#method.into_request" class="anchor"></a><h4 class="code-header">fn <a href="trait.IntoRequest.html#tymethod.into_request" class="fnname">into_request</a>(self) -&gt; <a class="struct" href="struct.Request.html" title="struct teaclave_rpc::Request">Request</a>&lt;T&gt;</h4></section></summary><div class='docblock'>Wrap the input message <code>T</code> in a <code>tonic::Request</code></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-MetadataMap" class="impl has-srclink"><a href="#impl-ToOwned-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; ToOwned for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: Clone,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&amp;self, target: &amp;mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-MetadataMap" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryFrom&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: Into&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -&gt; Result&lt;T, &lt;T as TryFrom&lt;U&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-MetadataMap" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; TryInto&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: TryFrom&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = &lt;U as TryFrom&lt;T&gt;&gt;::Error</h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -&gt; Result&lt;U, &lt;U as TryFrom&lt;T&gt;&gt;::Error&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-VZip%3CV%3E-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/ppv_lite86/types.rs.html#221">source</a><a href="#impl-VZip%3CV%3E-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;V, T&gt; <a class="trait" href="../ppv_lite86/types/trait.VZip.html" title="trait ppv_lite86::types::VZip">VZip</a>&lt;V&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="../ppv_lite86/types/trait.MultiLane.html" title="trait ppv_lite86::types::MultiLane">MultiLane</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><section id="method.vzip" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/ppv_lite86/types.rs.html#226">source</a><a href="#method.vzip" class="anchor"></a><h4 class="code-header">fn <a href="../ppv_lite86/types/trait.VZip.html#tymethod.vzip" class="fnname">vzip</a>(self) -&gt; V</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-MetadataMap" class="impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#334">source</a><a href="#impl-WithSubscriber-for-MetadataMap" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#169-171">source</a><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a>&lt;S&gt;(self, subscriber: S) -&gt; <a class="struct" href="../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: Into&lt;<a class="struct" href="../tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>&gt;,</span></h4></section></summary><div class='docblock'>Attaches the provided <a href="../tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
<a href="../tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#221">source</a><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -&gt; <a class="struct" href="../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Attaches the current <a href="../tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="../tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
<a href="../tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="teaclave_rpc" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>