1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-30 17:44:34 +01:00
actix-net/actix_rt/net/struct.TcpSocket.html
2024-10-01 00:01:00 +00:00

394 lines
69 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 TCP socket that has not yet been converted to a `TcpStream` or `TcpListener`."><title>TcpSocket in actix_rt::net - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_rt" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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" title="show sidebar"></button><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_rt/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_rt/index.html">actix_<wbr>rt</a><span class="version">2.10.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">TcpSocket</a></h2><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.bind" title="bind">bind</a></li><li><a href="#method.bind_device" title="bind_device">bind_device</a></li><li><a href="#method.connect" title="connect">connect</a></li><li><a href="#method.device" title="device">device</a></li><li><a href="#method.from_std_stream" title="from_std_stream">from_std_stream</a></li><li><a href="#method.keepalive" title="keepalive">keepalive</a></li><li><a href="#method.linger" title="linger">linger</a></li><li><a href="#method.listen" title="listen">listen</a></li><li><a href="#method.local_addr" title="local_addr">local_addr</a></li><li><a href="#method.new_v4" title="new_v4">new_v4</a></li><li><a href="#method.new_v6" title="new_v6">new_v6</a></li><li><a href="#method.nodelay" title="nodelay">nodelay</a></li><li><a href="#method.recv_buffer_size" title="recv_buffer_size">recv_buffer_size</a></li><li><a href="#method.reuseaddr" title="reuseaddr">reuseaddr</a></li><li><a href="#method.reuseport" title="reuseport">reuseport</a></li><li><a href="#method.send_buffer_size" title="send_buffer_size">send_buffer_size</a></li><li><a href="#method.set_keepalive" title="set_keepalive">set_keepalive</a></li><li><a href="#method.set_linger" title="set_linger">set_linger</a></li><li><a href="#method.set_nodelay" title="set_nodelay">set_nodelay</a></li><li><a href="#method.set_recv_buffer_size" title="set_recv_buffer_size">set_recv_buffer_size</a></li><li><a href="#method.set_reuseaddr" title="set_reuseaddr">set_reuseaddr</a></li><li><a href="#method.set_reuseport" title="set_reuseport">set_reuseport</a></li><li><a href="#method.set_send_buffer_size" title="set_send_buffer_size">set_send_buffer_size</a></li><li><a href="#method.set_tos" title="set_tos">set_tos</a></li><li><a href="#method.take_error" title="take_error">take_error</a></li><li><a href="#method.tos" title="tos">tos</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-AsFd-for-TcpSocket" title="AsFd">AsFd</a></li><li><a href="#impl-AsRawFd-for-TcpSocket" title="AsRawFd">AsRawFd</a></li><li><a href="#impl-Debug-for-TcpSocket" title="Debug">Debug</a></li><li><a href="#impl-FromRawFd-for-TcpSocket" title="FromRawFd">FromRawFd</a></li><li><a href="#impl-IntoRawFd-for-TcpSocket" title="IntoRawFd">IntoRawFd</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-TcpSocket" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-TcpSocket" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-TcpSocket" title="Send">Send</a></li><li><a href="#impl-Sync-for-TcpSocket" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-TcpSocket" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-TcpSocket" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow&#60;T&#62;">Borrow&#60;T&#62;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut&#60;T&#62;">BorrowMut&#60;T&#62;</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From&#60;T&#62;">From&#60;T&#62;</a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into&#60;U&#62;">Into&#60;U&#62;</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom&#60;U&#62;">TryFrom&#60;U&#62;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto&#60;U&#62;">TryInto&#60;U&#62;</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="index.html">In actix_<wbr>rt::<wbr>net</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">actix_rt</a>::<wbr><a href="index.html">net</a></span><h1>Struct <span class="struct">TcpSocket</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub struct TcpSocket { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A TCP socket that has not yet been converted to a <code>TcpStream</code> or
<code>TcpListener</code>.</p>
<p><code>TcpSocket</code> wraps an operating system socket and enables the caller to
configure the socket before establishing a TCP connection or accepting
inbound connections. The caller is able to set socket option and explicitly
bind the socket with a socket address.</p>
<p>The underlying socket is closed when the <code>TcpSocket</code> value is dropped.</p>
<p><code>TcpSocket</code> should only be used directly if the default configuration used
by <code>TcpStream::connect</code> and <code>TcpListener::bind</code> does not meet the required
use case.</p>
<p>Calling <code>TcpStream::connect("127.0.0.1:8080")</code> is equivalent to:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
<span class="kw">let </span>stream = socket.connect(addr).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
<p>Calling <code>TcpListener::bind("127.0.0.1:8080")</code> is equivalent to:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
<span class="comment">// On platforms with Berkeley-derived sockets, this allows to quickly
// rebind a socket, without needing to wait for the OS to clean up the
// previous one.
//
// On Windows, this allows rebinding sockets which are actively in use,
// which allows “socket hijacking”, so we explicitly don't set it here.
// https://docs.microsoft.com/en-us/windows/win32/winsock/using-so-reuseaddr-and-so-exclusiveaddruse
</span>socket.set_reuseaddr(<span class="bool-val">true</span>)<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
<p>Setting socket options not explicitly provided by <code>TcpSocket</code> may be done by
accessing the <code>RawFd</code>/<code>RawSocket</code> using <a href="https://doc.rust-lang.org/std/os/unix/io/trait.AsRawFd.html"><code>AsRawFd</code></a>/<a href="https://doc.rust-lang.org/std/os/windows/io/trait.AsRawSocket.html"><code>AsRawSocket</code></a> and
setting the option with a crate like <a href="https://docs.rs/socket2/"><code>socket2</code></a>.</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-TcpSocket" class="impl"><a href="#impl-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new_v4" class="method"><h4 class="code-header">pub fn <a href="#method.new_v4" class="fn">new_v4</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Creates a new socket configured for IPv4.</p>
<p>Calls <code>socket(2)</code> with <code>AF_INET</code> and <code>SOCK_STREAM</code>.</p>
<h5 id="returns"><a class="doc-anchor" href="#returns">§</a>Returns</h5>
<p>On success, the newly created <code>TcpSocket</code> is returned. If an error is
encountered, it is returned instead.</p>
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
<p>Create a new IPv4 socket and start listening.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">128</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.new_v6" class="method"><h4 class="code-header">pub fn <a href="#method.new_v6" class="fn">new_v6</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Creates a new socket configured for IPv6.</p>
<p>Calls <code>socket(2)</code> with <code>AF_INET6</code> and <code>SOCK_STREAM</code>.</p>
<h5 id="returns-1"><a class="doc-anchor" href="#returns-1">§</a>Returns</h5>
<p>On success, the newly created <code>TcpSocket</code> is returned. If an error is
encountered, it is returned instead.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<p>Create a new IPv6 socket and start listening.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"[::1]:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v6()<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">128</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_keepalive" class="method"><h4 class="code-header">pub fn <a href="#method.set_keepalive" class="fn">set_keepalive</a>(&amp;self, keepalive: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets value for the <code>SO_KEEPALIVE</code> option on this socket.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.keepalive" class="method"><h4 class="code-header">pub fn <a href="#method.keepalive" class="fn">keepalive</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Gets the value of the <code>SO_KEEPALIVE</code> option on this socket.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_reuseaddr" class="method"><h4 class="code-header">pub fn <a href="#method.set_reuseaddr" class="fn">set_reuseaddr</a>(&amp;self, reuseaddr: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Allows the socket to bind to an in-use address.</p>
<p>Behavior is platform specific. Refer to the target platforms
documentation for more details.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.set_reuseaddr(<span class="bool-val">true</span>)<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reuseaddr" class="method"><h4 class="code-header">pub fn <a href="#method.reuseaddr" class="fn">reuseaddr</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Retrieves the value set for <code>SO_REUSEADDR</code> on this socket.</p>
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.set_reuseaddr(<span class="bool-val">true</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(socket.reuseaddr().unwrap());
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_reuseport" class="method"><h4 class="code-header">pub fn <a href="#method.set_reuseport" class="fn">set_reuseport</a>(&amp;self, reuseport: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Allows the socket to bind to an in-use port. Only available for unix systems
(excluding Solaris &amp; Illumos).</p>
<p>Behavior is platform specific. Refer to the target platforms
documentation for more details.</p>
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.set_reuseport(<span class="bool-val">true</span>)<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.reuseport" class="method"><h4 class="code-header">pub fn <a href="#method.reuseport" class="fn">reuseport</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Allows the socket to bind to an in-use port. Only available for unix systems
(excluding Solaris &amp; Illumos).</p>
<p>Behavior is platform specific. Refer to the target platforms
documentation for more details.</p>
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.set_reuseport(<span class="bool-val">true</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(socket.reuseport().unwrap());
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_send_buffer_size" class="method"><h4 class="code-header">pub fn <a href="#method.set_send_buffer_size" class="fn">set_send_buffer_size</a>(&amp;self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the size of the TCP send buffer on this socket.</p>
<p>On most operating systems, this sets the <code>SO_SNDBUF</code> socket option.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.send_buffer_size" class="method"><h4 class="code-header">pub fn <a href="#method.send_buffer_size" class="fn">send_buffer_size</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the size of the TCP send buffer for this socket.</p>
<p>On most operating systems, this is the value of the <code>SO_SNDBUF</code> socket
option.</p>
<p>Note that if <a href="#method.set_send_buffer_size"><code>set_send_buffer_size</code></a> has been called on this socket
previously, the value returned by this function may not be the same as
the argument provided to <code>set_send_buffer_size</code>. This is for the
following reasons:</p>
<ul>
<li>Most operating systems have minimum and maximum allowed sizes for the
send buffer, and will clamp the provided value if it is below the
minimum or above the maximum. The minimum and maximum buffer sizes are
OS-dependent.</li>
<li>Linux will double the buffer size to account for internal bookkeeping
data, and returns the doubled value from <code>getsockopt(2)</code>. As per <code>man 7 socket</code>:
<blockquote>
<p>Sets or gets the maximum socket send buffer in bytes. The
kernel doubles this value (to allow space for bookkeeping
overhead) when it is set using <code>setsockopt(2)</code>, and this doubled
value is returned by <code>getsockopt(2)</code>.</p>
</blockquote>
</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_recv_buffer_size" class="method"><h4 class="code-header">pub fn <a href="#method.set_recv_buffer_size" class="fn">set_recv_buffer_size</a>(&amp;self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the size of the TCP receive buffer on this socket.</p>
<p>On most operating systems, this sets the <code>SO_RCVBUF</code> socket option.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.recv_buffer_size" class="method"><h4 class="code-header">pub fn <a href="#method.recv_buffer_size" class="fn">recv_buffer_size</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the size of the TCP receive buffer for this socket.</p>
<p>On most operating systems, this is the value of the <code>SO_RCVBUF</code> socket
option.</p>
<p>Note that if <a href="#method.set_recv_buffer_size"><code>set_recv_buffer_size</code></a> has been called on this socket
previously, the value returned by this function may not be the same as
the argument provided to <code>set_send_buffer_size</code>. This is for the
following reasons:</p>
<ul>
<li>Most operating systems have minimum and maximum allowed sizes for the
receive buffer, and will clamp the provided value if it is below the
minimum or above the maximum. The minimum and maximum buffer sizes are
OS-dependent.</li>
<li>Linux will double the buffer size to account for internal bookkeeping
data, and returns the doubled value from <code>getsockopt(2)</code>. As per <code>man 7 socket</code>:
<blockquote>
<p>Sets or gets the maximum socket send buffer in bytes. The
kernel doubles this value (to allow space for bookkeeping
overhead) when it is set using <code>setsockopt(2)</code>, and this doubled
value is returned by <code>getsockopt(2)</code>.</p>
</blockquote>
</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_linger" class="method"><h4 class="code-header">pub fn <a href="#method.set_linger" class="fn">set_linger</a>(&amp;self, dur: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the linger duration of this socket by setting the <code>SO_LINGER</code> option.</p>
<p>This option controls the action taken when a stream has unsent messages and the stream is
closed. If <code>SO_LINGER</code> is set, the system shall block the process until it can transmit the
data or until the time expires.</p>
<p>If <code>SO_LINGER</code> is not specified, and the socket is closed, the system handles the call in a
way that allows the process to continue as quickly as possible.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.linger" class="method"><h4 class="code-header">pub fn <a href="#method.linger" class="fn">linger</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Reads the linger duration for this socket by getting the <code>SO_LINGER</code>
option.</p>
<p>For more information about this option, see <a href="struct.TcpSocket.html#method.set_linger" title="method actix_rt::net::TcpSocket::set_linger"><code>set_linger</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_nodelay" class="method"><h4 class="code-header">pub fn <a href="#method.set_nodelay" class="fn">set_nodelay</a>(&amp;self, nodelay: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the value of the <code>TCP_NODELAY</code> option on this socket.</p>
<p>If set, this option disables the Nagle algorithm. This means that segments are always
sent as soon as possible, even if there is only a small amount of data. When not set,
data is buffered until there is a sufficient amount to send out, thereby avoiding
the frequent sending of small packets.</p>
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
<span class="macro">println!</span>(<span class="string">"{:?}"</span>, socket.nodelay()<span class="question-mark">?</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.nodelay" class="method"><h4 class="code-header">pub fn <a href="#method.nodelay" class="fn">nodelay</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Gets the value of the <code>TCP_NODELAY</code> option on this socket.</p>
<p>For more information about this option, see <a href="struct.TcpSocket.html#method.set_nodelay" title="method actix_rt::net::TcpSocket::set_nodelay"><code>set_nodelay</code></a>.</p>
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">let </span>stream = TcpSocket::new_v4()<span class="question-mark">?</span>;
stream.set_nodelay(<span class="bool-val">true</span>)<span class="question-mark">?</span>;</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.tos" class="method"><h4 class="code-header">pub fn <a href="#method.tos" class="fn">tos</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Gets the value of the <code>IP_TOS</code> option for this socket.</p>
<p>For more information about this option, see <a href="struct.TcpSocket.html#method.set_tos" title="method actix_rt::net::TcpSocket::set_tos"><code>set_tos</code></a>.</p>
<p><strong>NOTE:</strong> On Windows, <code>IP_TOS</code> is only supported on <a href="https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options">Windows 8+ or
Windows Server 2012+.</a></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_tos" class="method"><h4 class="code-header">pub fn <a href="#method.set_tos" class="fn">set_tos</a>(&amp;self, tos: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the value for the <code>IP_TOS</code> option on this socket.</p>
<p>This value sets the type-of-service field that is used in every packet
sent from this socket.</p>
<p><strong>NOTE:</strong> On Windows, <code>IP_TOS</code> is only supported on <a href="https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options">Windows 8+ or
Windows Server 2012+.</a></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.device" class="method"><h4 class="code-header">pub fn <a href="#method.device" class="fn">device</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;&gt;, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Gets the value for the <code>SO_BINDTODEVICE</code> option on this socket</p>
<p>This value gets the socket binded devices interface name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind_device" class="method"><h4 class="code-header">pub fn <a href="#method.bind_device" class="fn">bind_device</a>(&amp;self, interface: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Sets the value for the <code>SO_BINDTODEVICE</code> option on this socket</p>
<p>If a socket is bound to an interface, only packets received from that
particular interface are processed by the socket. Note that this only
works for some socket types, particularly <code>AF_INET</code> sockets.</p>
<p>If <code>interface</code> is <code>None</code> or an empty string it removes the binding.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.local_addr" class="method"><h4 class="code-header">pub fn <a href="#method.local_addr" class="fn">local_addr</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Gets the local address of this socket.</p>
<p>Will fail on windows if called before <code>bind</code>.</p>
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(socket.local_addr().unwrap().to_string(), <span class="string">"127.0.0.1:8080"</span>);
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.take_error" class="method"><h4 class="code-header">pub fn <a href="#method.take_error" class="fn">take_error</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the value of the <code>SO_ERROR</code> option.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind" class="method"><h4 class="code-header">pub fn <a href="#method.bind" class="fn">bind</a>(&amp;self, addr: <a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Binds the socket to the given address.</p>
<p>This calls the <code>bind(2)</code> operating-system function. Behavior is
platform specific. Refer to the target platforms documentation for more
details.</p>
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
<p>Bind a socket before listening.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(self, addr: <a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.TcpStream.html" title="struct actix_rt::net::TcpStream">TcpStream</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Establishes a TCP connection with a peer at the specified socket address.</p>
<p>The <code>TcpSocket</code> is consumed. Once the connection is established, a
connected <a href="struct.TcpStream.html" title="struct actix_rt::net::TcpStream"><code>TcpStream</code></a> is returned. If the connection fails, the
encountered error is returned.</p>
<p>This calls the <code>connect(2)</code> operating-system function. Behavior is
platform specific. Refer to the target platforms documentation for more
details.</p>
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
<p>Connecting to a peer.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
<span class="kw">let </span>stream = socket.connect(addr).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.listen" class="method"><h4 class="code-header">pub fn <a href="#method.listen" class="fn">listen</a>(self, backlog: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.TcpListener.html" title="struct actix_rt::net::TcpListener">TcpListener</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Converts the socket into a <code>TcpListener</code>.</p>
<p><code>backlog</code> defines the maximum number of pending connections are queued
by the operating system at any given time. Connection are removed from
the queue with <a href="struct.TcpListener.html#method.accept" title="method actix_rt::net::TcpListener::accept"><code>TcpListener::accept</code></a>. When the queue is full, the
operating-system will start rejecting connections.</p>
<p>This calls the <code>listen(2)</code> operating-system function, marking the socket
as a passive socket. Behavior is platform specific. Refer to the target
platforms documentation for more details.</p>
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
<p>Create a <code>TcpListener</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>std::io;
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; io::Result&lt;()&gt; {
<span class="kw">let </span>addr = <span class="string">"127.0.0.1:8080"</span>.parse().unwrap();
<span class="kw">let </span>socket = TcpSocket::new_v4()<span class="question-mark">?</span>;
socket.bind(addr)<span class="question-mark">?</span>;
<span class="kw">let </span>listener = socket.listen(<span class="number">1024</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_std_stream" class="method"><h4 class="code-header">pub fn <a href="#method.from_std_stream" class="fn">from_std_stream</a>(std_stream: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpStream.html" title="struct std::net::tcp::TcpStream">TcpStream</a>) -&gt; <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h4></section></summary><div class="docblock"><p>Converts a <a href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpStream.html" title="struct std::net::tcp::TcpStream"><code>std::net::TcpStream</code></a> into a <code>TcpSocket</code>. The provided
socket must not have been connected prior to calling this function. This
function is typically used together with crates such as <a href="https://docs.rs/socket2/"><code>socket2</code></a> to
configure socket options that are not available on <code>TcpSocket</code>.</p>
<h5 id="notes"><a class="doc-anchor" href="#notes">§</a>Notes</h5>
<p>The caller is responsible for ensuring that the socket is in
non-blocking mode. Otherwise all I/O operations on the socket
will block the thread, which will cause unexpected behavior.
Non-blocking mode can be set using <a href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpStream.html#method.set_nonblocking" title="method std::net::tcp::TcpStream::set_nonblocking"><code>set_nonblocking</code></a>.</p>
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tokio::net::TcpSocket;
<span class="kw">use </span>socket2::{Domain, Socket, Type};
<span class="attr">#[tokio::main]
</span><span class="kw">async fn </span>main() -&gt; std::io::Result&lt;()&gt; {
<span class="kw">let </span>socket2_socket = Socket::new(Domain::IPV4, Type::STREAM, <span class="prelude-val">None</span>)<span class="question-mark">?</span>;
socket2_socket.set_nonblocking(<span class="bool-val">true</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>socket = TcpSocket::from_std_stream(socket2_socket.into());
<span class="prelude-val">Ok</span>(())
}</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-AsFd-for-TcpSocket" class="impl"><a href="#impl-AsFd-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/os/fd/owned/trait.AsFd.html" title="trait std::os::fd::owned::AsFd">AsFd</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_fd" class="method trait-impl"><a href="#method.as_fd" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/os/fd/owned/trait.AsFd.html#tymethod.as_fd" class="fn">as_fd</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/os/fd/owned/struct.BorrowedFd.html" title="struct std::os::fd::owned::BorrowedFd">BorrowedFd</a>&lt;'_&gt;</h4></section></summary><div class='docblock'>Borrows the file descriptor. <a href="https://doc.rust-lang.org/nightly/std/os/fd/owned/trait.AsFd.html#tymethod.as_fd">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AsRawFd-for-TcpSocket" class="impl"><a href="#impl-AsRawFd-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.AsRawFd.html" title="trait std::os::fd::raw::AsRawFd">AsRawFd</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.as_raw_fd" class="method trait-impl"><a href="#method.as_raw_fd" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.AsRawFd.html#tymethod.as_raw_fd" class="fn">as_raw_fd</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Extracts the raw file descriptor. <a href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.AsRawFd.html#tymethod.as_raw_fd">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-TcpSocket" class="impl"><a href="#impl-Debug-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, fmt: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromRawFd-for-TcpSocket" class="impl"><a href="#impl-FromRawFd-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.FromRawFd.html" title="trait std::os::fd::raw::FromRawFd">FromRawFd</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_raw_fd" class="method trait-impl"><a href="#method.from_raw_fd" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.FromRawFd.html#tymethod.from_raw_fd" class="fn">from_raw_fd</a>(fd: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h4></section></summary><div class="docblock"><p>Converts a <code>RawFd</code> to a <code>TcpSocket</code>.</p>
<h5 id="notes-1"><a class="doc-anchor" href="#notes-1">§</a>Notes</h5>
<p>The caller is responsible for ensuring that the socket is in
non-blocking mode.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-IntoRawFd-for-TcpSocket" class="impl"><a href="#impl-IntoRawFd-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.IntoRawFd.html" title="trait std::os::fd::raw::IntoRawFd">IntoRawFd</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into_raw_fd" class="method trait-impl"><a href="#method.into_raw_fd" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.IntoRawFd.html#tymethod.into_raw_fd" class="fn">into_raw_fd</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Consumes this object, returning the raw underlying file descriptor. <a href="https://doc.rust-lang.org/nightly/std/os/fd/raw/trait.IntoRawFd.html#tymethod.into_raw_fd">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-TcpSocket" class="impl"><a href="#impl-Freeze-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section><section id="impl-RefUnwindSafe-for-TcpSocket" class="impl"><a href="#impl-RefUnwindSafe-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section><section id="impl-Send-for-TcpSocket" class="impl"><a href="#impl-Send-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section><section id="impl-Sync-for-TcpSocket" class="impl"><a href="#impl-Sync-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section><section id="impl-Unpin-for-TcpSocket" class="impl"><a href="#impl-Unpin-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section><section id="impl-UnwindSafe-for-TcpSocket" class="impl"><a href="#impl-UnwindSafe-for-TcpSocket" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.TcpSocket.html" title="struct actix_rt::net::TcpSocket">TcpSocket</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#138">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#139">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#209">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#211">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#765">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#768">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#748-750">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#758">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fn">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><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#805-807">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#809">source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#812">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#790-792">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#794">source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#797">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>