Files
google-apis-rs/socket2/struct.Socket.html
2021-04-02 00:20:57 +08:00

463 lines
167 KiB
HTML
Raw 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="API documentation for the Rust `Socket` struct in crate `socket2`."><meta name="keywords" content="rust, rustlang, rust-lang, Socket"><title>socket2::Socket - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../socket2/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Struct Socket</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.accept">accept</a><a href="#method.accept_raw">accept_raw</a><a href="#method.bind">bind</a><a href="#method.broadcast">broadcast</a><a href="#method.connect">connect</a><a href="#method.connect_timeout">connect_timeout</a><a href="#method.join_multicast_v4">join_multicast_v4</a><a href="#method.join_multicast_v6">join_multicast_v6</a><a href="#method.keepalive">keepalive</a><a href="#method.leave_multicast_v4">leave_multicast_v4</a><a href="#method.leave_multicast_v6">leave_multicast_v6</a><a href="#method.linger">linger</a><a href="#method.listen">listen</a><a href="#method.local_addr">local_addr</a><a href="#method.multicast_hops_v6">multicast_hops_v6</a><a href="#method.multicast_if_v4">multicast_if_v4</a><a href="#method.multicast_if_v6">multicast_if_v6</a><a href="#method.multicast_loop_v4">multicast_loop_v4</a><a href="#method.multicast_loop_v6">multicast_loop_v6</a><a href="#method.multicast_ttl_v4">multicast_ttl_v4</a><a href="#method.new">new</a><a href="#method.new_raw">new_raw</a><a href="#method.nodelay">nodelay</a><a href="#method.only_v6">only_v6</a><a href="#method.out_of_band_inline">out_of_band_inline</a><a href="#method.peek">peek</a><a href="#method.peek_from">peek_from</a><a href="#method.peer_addr">peer_addr</a><a href="#method.read_timeout">read_timeout</a><a href="#method.recv">recv</a><a href="#method.recv_buffer_size">recv_buffer_size</a><a href="#method.recv_from">recv_from</a><a href="#method.recv_from_vectored">recv_from_vectored</a><a href="#method.recv_from_vectored_with_flags">recv_from_vectored_with_flags</a><a href="#method.recv_from_with_flags">recv_from_with_flags</a><a href="#method.recv_out_of_band">recv_out_of_band</a><a href="#method.recv_vectored">recv_vectored</a><a href="#method.recv_vectored_with_flags">recv_vectored_with_flags</a><a href="#method.recv_with_flags">recv_with_flags</a><a href="#method.reuse_address">reuse_address</a><a href="#method.send">send</a><a href="#method.send_buffer_size">send_buffer_size</a><a href="#method.send_out_of_band">send_out_of_band</a><a href="#method.send_to">send_to</a><a href="#method.send_to_vectored">send_to_vectored</a><a href="#method.send_to_vectored_with_flags">send_to_vectored_with_flags</a><a href="#method.send_to_with_flags">send_to_with_flags</a><a href="#method.send_vectored">send_vectored</a><a href="#method.send_vectored_with_flags">send_vectored_with_flags</a><a href="#method.send_with_flags">send_with_flags</a><a href="#method.set_broadcast">set_broadcast</a><a href="#method.set_keepalive">set_keepalive</a><a href="#method.set_linger">set_linger</a><a href="#method.set_multicast_hops_v6">set_multicast_hops_v6</a><a href="#method.set_multicast_if_v4">set_multicast_if_v4</a><a href="#method.set_multicast_if_v6">set_multicast_if_v6</a><a href="#method.set_multicast_loop_v4">set_multicast_loop_v4</a><a href="#method.set_multicast_loop_v6">set_multicast_loop_v6</a><a href="#method.set_multicast_ttl_v4">set_multicast_ttl_v4</a><a href="#method.set_nodelay">set_nodelay</a><a href="#method.set_nonblocking">set_nonblocking</a><a href="#method.set_only_v6">set_only_v6</a><a href="#method.set_out_of_band_inline">set_out_of_band_inline</a><a href="#method.set_read_timeout">set_read_timeout</a><a href="#method.set_recv_buffer_size">set_recv_buffer_size</a><a href="#method.set_reuse_address">set_reuse_address</a><a href="#method.set_send_buffer_size">set_send_buffer_size</a><a href="#method.set_tcp_keepalive">set_tcp_keepalive</a><a href="#method.set_ttl">set_ttl</a><a href="#method.set_unicast_hops_v6">set_unicast_hops_v6</a><a href="#method.set_write_timeout">set_write_timeout</a><a href="#method.shutdown">shutdown</a><a href="#method.take_error">take_error</a><a href="#method.try_clone">try_clone</a><a href="#method.ttl">ttl</a><a href="#method.unicast_hops_v6">unicast_hops_v6</a><a href="#method.write_timeout">write_timeout</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-AsRawFd">AsRawFd</a><a href="#impl-Debug">Debug</a><a href="#impl-Drop">Drop</a><a href="#impl-From%3CTcpListener%3E">From&lt;TcpListener&gt;</a><a href="#impl-From%3CTcpStream%3E">From&lt;TcpStream&gt;</a><a href="#impl-From%3CUdpSocket%3E">From&lt;UdpSocket&gt;</a><a href="#impl-FromRawFd">FromRawFd</a><a href="#impl-IntoRawFd">IntoRawFd</a><a href="#impl-Read">Read</a><a href="#impl-Write">Write</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="index.html">socket2</a></p><div id="sidebar-vars" data-name="Socket" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">socket2</a>::<wbr><a class="struct" href="">Socket</a></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../src/socket2/socket.rs.html#70-73" title="goto source code">[src]</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust struct">pub struct Socket { /* fields omitted */ }</pre></div><div class="docblock"><p>Owned wrapper around a system socket.</p>
<p>This type simply wraps an instance of a file descriptor (<code>c_int</code>) on Unix
and an instance of <code>SOCKET</code> on Windows. This is the main type exported by
this crate and is intended to mirror the raw semantics of sockets on
platforms as closely as possible. Almost all methods correspond to
precisely one libc or OS API call which is essentially just a &quot;Rustic
translation&quot; of what's below.</p>
<p>This type can be freely converted into the network primitives provided by
the standard library, such as <a href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpStream.html"><code>TcpStream</code></a> or <a href="https://doc.rust-lang.org/nightly/std/net/udp/struct.UdpSocket.html"><code>UdpSocket</code></a>, using the
<a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="Into"><code>Into</code></a> trait, see the example below.</p>
<h1 id="notes" class="section-header"><a href="#notes">Notes</a></h1>
<p>Some methods that set options on <code>Socket</code> require two system calls to set
there options without overwriting previously set options. We do this by
first getting the current settings, applying the desired changes and than
updating the settings. This means that the operation is <strong>not</strong> atomic. This
can lead to a data race when two threads are changing options in parallel.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::{<span class="ident">SocketAddr</span>, <span class="ident">TcpListener</span>};
<span class="kw">use</span> <span class="ident">socket2</span>::{<span class="ident">Socket</span>, <span class="ident">Domain</span>, <span class="ident">Type</span>};
<span class="comment">// create a TCP listener bound to two addresses</span>
<span class="kw">let</span> <span class="ident">socket</span> <span class="op">=</span> <span class="ident">Socket</span>::<span class="ident">new</span>(<span class="ident">Domain</span>::<span class="ident">IPV4</span>, <span class="ident">Type</span>::<span class="ident">STREAM</span>, <span class="prelude-val">None</span>)<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">address</span>: <span class="ident">SocketAddr</span> <span class="op">=</span> <span class="string">&quot;[::1]:12345&quot;</span>.<span class="ident">parse</span>().<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">address</span> <span class="op">=</span> <span class="ident">address</span>.<span class="ident">into</span>();
<span class="ident">socket</span>.<span class="ident">bind</span>(<span class="kw-2">&amp;</span><span class="ident">address</span>)<span class="question-mark">?</span>;
<span class="ident">socket</span>.<span class="ident">bind</span>(<span class="kw-2">&amp;</span><span class="ident">address</span>)<span class="question-mark">?</span>;
<span class="ident">socket</span>.<span class="ident">listen</span>(<span class="number">128</span>)<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">listener</span>: <span class="ident">TcpListener</span> <span class="op">=</span> <span class="ident">socket</span>.<span class="ident">into</span>();
<span class="comment">// ...</span></pre></div>
</div><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#75-609" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;domain: <a class="struct" href="../socket2/struct.Domain.html" title="struct socket2::Domain">Domain</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;ty: <a class="struct" href="../socket2/struct.Type.html" title="struct socket2::Type">Type</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;protocol: <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="../socket2/struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>&gt;<br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#86-89" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new socket and sets common flags.</p>
<p>This function corresponds to <code>socket(2)</code> on Unix and <code>WSASocketW</code> on
Windows.</p>
<p>On Unix-like systems, the close-on-exec flag is set on the new socket.
Additionally, on Apple platforms <code>SOCK_NOSIGPIPE</code> is set. On Windows,
the socket is made non-inheritable.</p>
<p><a href="../socket2/struct.Socket.html#method.new_raw" title="Socket::new_raw"><code>Socket::new_raw</code></a> can be used if you don't want these flags to be set.</p>
</div><h4 id="method.new_raw" class="method"><code>pub fn <a href="#method.new_raw" class="fnname">new_raw</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;domain: <a class="struct" href="../socket2/struct.Domain.html" title="struct socket2::Domain">Domain</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;ty: <a class="struct" href="../socket2/struct.Type.html" title="struct socket2::Type">Type</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;protocol: <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="../socket2/struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>&gt;<br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#95-98" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new socket ready to be configured.</p>
<p>This function corresponds to <code>socket(2)</code> on Unix and <code>WSASocketW</code> on
Windows and simply creates a new socket, no other configuration is done.</p>
</div><h4 id="method.bind" class="method"><code>pub fn <a href="#method.bind" class="fnname">bind</a>(&amp;self, address: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#145-147" title="goto source code">[src]</a></h4><div class="docblock"><p>Binds this socket to the specified address.</p>
<p>This function directly corresponds to the <code>bind(2)</code> function on Windows
and Unix.</p>
</div><h4 id="method.connect" class="method"><code>pub fn <a href="#method.connect" class="fnname">connect</a>(&amp;self, address: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#163-165" title="goto source code">[src]</a></h4><div class="docblock"><p>Initiate a connection on this socket to the specified address.</p>
<p>This function directly corresponds to the <code>connect(2)</code> function on
Windows and Unix.</p>
<p>An error will be returned if <code>listen</code> or <code>connect</code> has already been
called on this builder.</p>
<h1 id="notes-1" class="section-header"><a href="#notes-1">Notes</a></h1>
<p>When using a non-blocking connect (by setting the socket into
non-blocking mode before calling this function), socket option can't be
set <em>while connecting</em>. This will cause errors on Windows. Socket
options can be safely set before and after connecting the socket.</p>
</div><h4 id="method.connect_timeout" class="method"><code>pub fn <a href="#method.connect_timeout" class="fnname">connect_timeout</a>(&amp;self, addr: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>, timeout: <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="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#186-200" title="goto source code">[src]</a></h4><div class="docblock"><p>Initiate a connection on this socket to the specified address, only
only waiting for a certain period of time for the connection to be
established.</p>
<p>Unlike many other methods on <code>Socket</code>, this does <em>not</em> correspond to a
single C function. It sets the socket to nonblocking mode, connects via
connect(2), and then waits for the connection to complete with poll(2)
on Unix and select on Windows. When the connection is complete, the
socket is set back to blocking mode. On Unix, this will loop over
<code>EINTR</code> errors.</p>
<h1 id="warnings" class="section-header"><a href="#warnings">Warnings</a></h1>
<p>The non-blocking state of the socket is overridden by this function -
it will be returned in blocking mode on success, and in an indeterminate
state on failure.</p>
<p>If the connection request times out, it may still be processing in the
background - a second call to <code>connect</code> or <code>connect_timeout</code> may fail.</p>
</div><h4 id="method.listen" class="method"><code>pub fn <a href="#method.listen" class="fnname">listen</a>(&amp;self, backlog: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#210-212" title="goto source code">[src]</a></h4><div class="docblock"><p>Mark a socket as ready to accept incoming connection requests using
<a href="../socket2/struct.Socket.html#method.accept" title="Socket::accept()"><code>Socket::accept()</code></a>.</p>
<p>This function directly corresponds to the <code>listen(2)</code> function on
Windows and Unix.</p>
<p>An error will be returned if <code>listen</code> or <code>connect</code> has already been
called on this builder.</p>
</div><h4 id="method.accept" class="method"><code>pub fn <a href="#method.accept" class="fnname">accept</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#221-250" title="goto source code">[src]</a></h4><div class="docblock"><p>Accept a new incoming connection from this listener.</p>
<p>This function uses <code>accept4(2)</code> on platforms that support it and
<code>accept(2)</code> platforms that do not.</p>
<p>This function sets the same flags as in done for <a href="../socket2/struct.Socket.html#method.new" title="Socket::new"><code>Socket::new</code></a>,
<a href="../socket2/struct.Socket.html#method.accept_raw" title="Socket::accept_raw"><code>Socket::accept_raw</code></a> can be used if you don't want to set those flags.</p>
</div><h4 id="method.accept_raw" class="method"><code>pub fn <a href="#method.accept_raw" class="fnname">accept_raw</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#256-258" title="goto source code">[src]</a></h4><div class="docblock"><p>Accept a new incoming connection from this listener.</p>
<p>This function directly corresponds to the <code>accept(2)</code> function on
Windows and Unix.</p>
</div><h4 id="method.local_addr" class="method"><code>pub fn <a href="#method.local_addr" class="fnname">local_addr</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#268-270" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the socket address of the local half of this socket.</p>
<h1 id="notes-2" class="section-header"><a href="#notes-2">Notes</a></h1>
<p>Depending on the OS this may return an error if the socket is not
<a href="../socket2/struct.Socket.html#method.bind">bound</a>.</p>
</div><h4 id="method.peer_addr" class="method"><code>pub fn <a href="#method.peer_addr" class="fnname">peer_addr</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#279-281" title="goto source code">[src]</a></h4><div class="docblock"><p>Returns the socket address of the remote peer of this socket.</p>
<h1 id="notes-3" class="section-header"><a href="#notes-3">Notes</a></h1>
<p>This returns an error if the socket is not <a href="../socket2/struct.Socket.html#method.connect"><code>connect</code>ed</a>.</p>
</div><h4 id="method.try_clone" class="method"><code>pub fn <a href="#method.try_clone" class="fnname">try_clone</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#296-298" title="goto source code">[src]</a></h4><div class="docblock"><p>Creates a new independently owned handle to the underlying socket.</p>
<h1 id="notes-4" class="section-header"><a href="#notes-4">Notes</a></h1>
<p>On Unix this uses <code>F_DUPFD_CLOEXEC</code> and thus sets the <code>FD_CLOEXEC</code> on
the returned socket.</p>
<p>On Windows this uses <code>WSA_FLAG_NO_HANDLE_INHERIT</code> setting inheriting to
false.</p>
<p>On Windows this can <strong>not</strong> be used function cannot be used on a
QOS-enabled socket, see
<a href="https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaduplicatesocketw">https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaduplicatesocketw</a>.</p>
</div><h4 id="method.set_nonblocking" class="method"><code>pub fn <a href="#method.set_nonblocking" class="fnname">set_nonblocking</a>(&amp;self, nonblocking: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#308-310" title="goto source code">[src]</a></h4><div class="docblock"><p>Moves this TCP stream into or out of nonblocking mode.</p>
<h1 id="notes-5" class="section-header"><a href="#notes-5">Notes</a></h1>
<p>On Unix this corresponds to calling <code>fcntl</code> (un)setting <code>O_NONBLOCK</code>.</p>
<p>On Windows this corresponds to calling <code>ioctlsocket</code> (un)setting
<code>FIONBIO</code>.</p>
</div><h4 id="method.shutdown" class="method"><code>pub fn <a href="#method.shutdown" class="fnname">shutdown</a>(&amp;self, how: <a class="enum" href="https://doc.rust-lang.org/nightly/std/net/enum.Shutdown.html" title="enum std::net::Shutdown">Shutdown</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#316-318" title="goto source code">[src]</a></h4><div class="docblock"><p>Shuts down the read, write, or both halves of this connection.</p>
<p>This function will cause all pending and future I/O on the specified
portions to return immediately with an appropriate value.</p>
</div><h4 id="method.recv" class="method"><code>pub fn <a href="#method.recv" class="fnname">recv</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#340-342" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives data on the socket from the remote address to which it is
connected.</p>
<p>The <a href="../socket2/struct.Socket.html#method.connect"><code>connect</code></a> method will connect this socket to a remote address.
This method might fail if the socket is not connected.</p>
<h1 id="safety" class="section-header"><a href="#safety">Safety</a></h1>
<p>Normally casting a <code>&amp;mut [u8]</code> to <code>&amp;mut [MaybeUninit&lt;u8&gt;]</code> would be
unsound, as that allows us to write uninitialised bytes to the buffer.
However this implementation promises to not write uninitialised bytes to
the <code>buf</code>fer and passes it directly to <code>recv(2)</code> system call. This
promise ensures that this function can be called using a <code>buf</code>fer of
type <code>&amp;mut [u8]</code>.</p>
<p>Note that the <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read" title="io::Read::read"><code>io::Read::read</code></a> implementation calls this function with
a <code>buf</code>fer of type <code>&amp;mut [u8]</code>, allowing initialised buffers to be used
without using <code>unsafe</code>.</p>
</div><h4 id="method.recv_out_of_band" class="method"><code>pub fn <a href="#method.recv_out_of_band" class="fnname">recv_out_of_band</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#351-353" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives out-of-band (OOB) data on the socket from the remote address to
which it is connected by setting the <code>MSG_OOB</code> flag for this call.</p>
<p>For more information, see <a href="../socket2/struct.Socket.html#method.recv"><code>recv</code></a>, <a href="../socket2/struct.Socket.html#method.out_of_band_inline"><code>out_of_band_inline</code></a>.</p>
</div><h4 id="method.recv_with_flags" class="method"><code>pub fn <a href="#method.recv_with_flags" class="fnname">recv_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#359-365" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.recv"><code>recv</code></a> but allows for specification of arbitrary flags to
the underlying <code>recv</code> call.</p>
</div><h4 id="method.recv_vectored" class="method"><code>pub fn <a href="#method.recv_vectored" class="fnname">recv_vectored</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="../socket2/struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#393-398" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives data on the socket from the remote address to which it is
connected. Unlike <a href="../socket2/struct.Socket.html#method.recv"><code>recv</code></a> this allows passing multiple buffers.</p>
<p>The <a href="../socket2/struct.Socket.html#method.connect"><code>connect</code></a> method will connect this socket to a remote address.
This method might fail if the socket is not connected.</p>
<p>In addition to the number of bytes read, this function returns the flags
for the received message. See <a href="../socket2/struct.RecvFlags.html" title="RecvFlags"><code>RecvFlags</code></a> for more information about
the returned flags.</p>
<h1 id="safety-1" class="section-header"><a href="#safety-1">Safety</a></h1>
<p>Normally casting a <code>IoSliceMut</code> to <code>MaybeUninitSlice</code> would be unsound,
as that allows us to write uninitialised bytes to the buffer. However
this implementation promises to not write uninitialised bytes to the
<code>bufs</code> and passes it directly to <code>recvmsg(2)</code> system call. This promise
ensures that this function can be called using <code>bufs</code> of type <code>&amp;mut [IoSliceMut]</code>.</p>
<p>Note that the <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored" title="io::Read::read_vectored"><code>io::Read::read_vectored</code></a> implementation calls this
function with <code>buf</code>s of type <code>&amp;mut [IoSliceMut]</code>, allowing initialised
buffers to be used without using <code>unsafe</code>.</p>
</div><h4 id="method.recv_vectored_with_flags" class="method"><code>pub fn <a href="#method.recv_vectored_with_flags" class="fnname">recv_vectored_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="../socket2/struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#412-418" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a> but allows for specification of arbitrary
flags to the underlying <code>recvmsg</code>/<code>WSARecv</code> call.</p>
<h1 id="safety-2" class="section-header"><a href="#safety-2">Safety</a></h1>
<p><code>recv_from_vectored</code> makes the same safety guarantees regarding <code>bufs</code>
as <a href="../socket2/struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a>.</p>
</div><h4 id="method.peek" class="method"><code>pub fn <a href="#method.peek" class="fnname">peek</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#433-435" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives data on the socket from the remote adress to which it is
connected, without removing that data from the queue. On success,
returns the number of bytes peeked.</p>
<p>Successive calls return the same data. This is accomplished by passing
<code>MSG_PEEK</code> as a flag to the underlying <code>recv</code> system call.</p>
<h1 id="safety-3" class="section-header"><a href="#safety-3">Safety</a></h1>
<p><code>peek</code> makes the same safety guarantees regarding the <code>buf</code>fer as
<a href="../socket2/struct.Socket.html#method.recv"><code>recv</code></a>.</p>
</div><h4 id="method.recv_from" class="method"><code>pub fn <a href="#method.recv_from" class="fnname">recv_from</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#446-448" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives data from the socket. On success, returns the number of bytes
read and the address from whence the data came.</p>
<h1 id="safety-4" class="section-header"><a href="#safety-4">Safety</a></h1>
<p><code>recv_from</code> makes the same safety guarantees regarding the <code>buf</code>fer as
<a href="../socket2/struct.Socket.html#method.recv"><code>recv</code></a>.</p>
</div><h4 id="method.recv_from_with_flags" class="method"><code>pub fn <a href="#method.recv_from_with_flags" class="fnname">recv_from_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#454-460" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.recv_from"><code>recv_from</code></a> but allows for specification of arbitrary
flags to the underlying <code>recvfrom</code> call.</p>
</div><h4 id="method.recv_from_vectored" class="method"><code>pub fn <a href="#method.recv_from_vectored" class="fnname">recv_from_vectored</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="../socket2/struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#475-480" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives data from the socket. Returns the amount of bytes read, the
<a href="../socket2/struct.RecvFlags.html" title="RecvFlags"><code>RecvFlags</code></a> and the remote address from the data is coming. Unlike
<a href="../socket2/struct.Socket.html#method.recv_from"><code>recv_from</code></a> this allows passing multiple buffers.</p>
<h1 id="safety-5" class="section-header"><a href="#safety-5">Safety</a></h1>
<p><code>recv_from_vectored</code> makes the same safety guarantees regarding <code>bufs</code>
as <a href="../socket2/struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a>.</p>
</div><h4 id="method.recv_from_vectored_with_flags" class="method"><code>pub fn <a href="#method.recv_from_vectored_with_flags" class="fnname">recv_from_vectored_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="../socket2/struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#494-500" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.recv_from_vectored"><code>recv_from_vectored</code></a> but allows for specification of
arbitrary flags to the underlying <code>recvmsg</code>/<code>WSARecvFrom</code> call.</p>
<h1 id="safety-6" class="section-header"><a href="#safety-6">Safety</a></h1>
<p><code>recv_from_vectored</code> makes the same safety guarantees regarding <code>bufs</code>
as <a href="../socket2/struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a>.</p>
</div><h4 id="method.peek_from" class="method"><code>pub fn <a href="#method.peek_from" class="fnname">peek_from</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="union" href="https://doc.rust-lang.org/nightly/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#516-518" title="goto source code">[src]</a></h4><div class="docblock"><p>Receives data from the socket, without removing it from the queue.</p>
<p>Successive calls return the same data. This is accomplished by passing
<code>MSG_PEEK</code> as a flag to the underlying <code>recvfrom</code> system call.</p>
<p>On success, returns the number of bytes peeked and the address from
whence the data came.</p>
<h1 id="safety-7" class="section-header"><a href="#safety-7">Safety</a></h1>
<p><code>peek_from</code> makes the same safety guarantees regarding the <code>buf</code>fer as
<a href="../socket2/struct.Socket.html#method.recv"><code>recv</code></a>.</p>
</div><h4 id="method.send" class="method"><code>pub fn <a href="#method.send" class="fnname">send</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#526-528" title="goto source code">[src]</a></h4><div class="docblock"><p>Sends data on the socket to a connected peer.</p>
<p>This is typically used on TCP sockets or datagram sockets which have
been connected.</p>
<p>On success returns the number of bytes that were sent.</p>
</div><h4 id="method.send_with_flags" class="method"><code>pub fn <a href="#method.send_with_flags" class="fnname">send_with_flags</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#534-536" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="#method.send"><code>send</code></a> but allows for specification of arbitrary flags to the underlying
<code>send</code> call.</p>
</div><h4 id="method.send_vectored" class="method"><code>pub fn <a href="#method.send_vectored" class="fnname">send_vectored</a>(&amp;self, bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#540-542" title="goto source code">[src]</a></h4><div class="docblock"><p>Send data to the connected peer. Returns the amount of bytes written.</p>
</div><h4 id="method.send_vectored_with_flags" class="method"><code>pub fn <a href="#method.send_vectored_with_flags" class="fnname">send_vectored_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#549-555" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.send_vectored"><code>send_vectored</code></a> but allows for specification of arbitrary
flags to the underlying <code>sendmsg</code>/<code>WSASend</code> call.</p>
</div><h4 id="method.send_out_of_band" class="method"><code>pub fn <a href="#method.send_out_of_band" class="fnname">send_out_of_band</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#564-566" title="goto source code">[src]</a></h4><div class="docblock"><p>Sends out-of-band (OOB) data on the socket to connected peer
by setting the <code>MSG_OOB</code> flag for this call.</p>
<p>For more information, see <a href="#method.send"><code>send</code></a>, <a href="#method.out_of_band_inline"><code>out_of_band_inline</code></a>.</p>
</div><h4 id="method.send_to" class="method"><code>pub fn <a href="#method.send_to" class="fnname">send_to</a>(&amp;self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, addr: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#572-574" title="goto source code">[src]</a></h4><div class="docblock"><p>Sends data on the socket to the given address. On success, returns the
number of bytes written.</p>
<p>This is typically used on UDP or datagram-oriented sockets.</p>
</div><h4 id="method.send_to_with_flags" class="method"><code>pub fn <a href="#method.send_to_with_flags" class="fnname">send_to_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;addr: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#580-587" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.send_to"><code>send_to</code></a> but allows for specification of arbitrary flags
to the underlying <code>sendto</code> call.</p>
</div><h4 id="method.send_to_vectored" class="method"><code>pub fn <a href="#method.send_to_vectored" class="fnname">send_to_vectored</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;addr: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#592-594" title="goto source code">[src]</a></h4><div class="docblock"><p>Send data to a peer listening on <code>addr</code>. Returns the amount of bytes
written.</p>
</div><h4 id="method.send_to_vectored_with_flags" class="method"><code>pub fn <a href="#method.send_to_vectored_with_flags" class="fnname">send_to_vectored_with_flags</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;addr: &amp;<a class="struct" href="../socket2/struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#601-608" title="goto source code">[src]</a></h4><div class="docblock"><p>Identical to <a href="../socket2/struct.Socket.html#method.send_to_vectored"><code>send_to_vectored</code></a> but allows for specification of
arbitrary flags to the underlying <code>sendmsg</code>/<code>WSASendTo</code> call.</p>
</div></div><h3 id="impl-1" class="impl"><code class="in-band">impl <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#666-893" title="goto source code">[src]</a></h3><div class="docblock"><p>Socket options get/set using <code>SOL_SOCKET</code>.</p>
<p>Additional documentation can be found in documentation of the OS.</p>
<ul>
<li>Linux: <a href="https://man7.org/linux/man-pages/man7/socket.7.html">https://man7.org/linux/man-pages/man7/socket.7.html</a></li>
<li>Windows: <a href="https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options">https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options</a></li>
</ul>
</div><div class="impl-items"><h4 id="method.broadcast" class="method"><code>pub fn <a href="#method.broadcast" class="fnname">broadcast</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#672-677" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>SO_BROADCAST</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_broadcast"><code>set_broadcast</code></a>.</p>
</div><h4 id="method.set_broadcast" class="method"><code>pub fn <a href="#method.set_broadcast" class="fnname">set_broadcast</a>(&amp;self, broadcast: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#683-692" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>SO_BROADCAST</code> option for this socket.</p>
<p>When enabled, this socket is allowed to send packets to a broadcast
address.</p>
</div><h4 id="method.take_error" class="method"><code>pub fn <a href="#method.take_error" class="fnname">take_error</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::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;&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#699-705" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>SO_ERROR</code> option on this socket.</p>
<p>This will retrieve the stored error in the underlying socket, clearing
the field in the process. This can be useful for checking errors between
calls.</p>
</div><h4 id="method.keepalive" class="method"><code>pub fn <a href="#method.keepalive" class="fnname">keepalive</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#712-717" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>SO_KEEPALIVE</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_keepalive"><code>set_keepalive</code></a>.</p>
</div><h4 id="method.set_keepalive" class="method"><code>pub fn <a href="#method.set_keepalive" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#722-731" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_KEEPALIVE</code> option on this socket.</p>
<p>Enable sending of keep-alive messages on connection-oriented sockets.</p>
</div><h4 id="method.linger" class="method"><code>pub fn <a href="#method.linger" class="fnname">linger</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::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;&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#738-742" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>SO_LINGER</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_linger"><code>set_linger</code></a>.</p>
</div><h4 id="method.set_linger" class="method"><code>pub fn <a href="#method.set_linger" class="fnname">set_linger</a>(&amp;self, linger: <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="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#758-761" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_LINGER</code> option on this socket.</p>
<p>If <code>linger</code> is not <code>None</code>, a close(2) or shutdown(2) will not return
until all queued messages for the socket have been successfully sent or
the linger timeout has been reached. Otherwise, the call returns
immediately and the closing is done in the background. When the socket
is closed as part of exit(2), it always lingers in the background.</p>
<h1 id="notes-6" class="section-header"><a href="#notes-6">Notes</a></h1>
<p>On most OSs the duration only has a precision of seconds and will be
silently truncated.</p>
<p>On Apple platforms (e.g. macOS, iOS, etc) this uses <code>SO_LINGER_SEC</code>.</p>
</div><h4 id="method.out_of_band_inline" class="method"><code>pub fn <a href="#method.out_of_band_inline" class="fnname">out_of_band_inline</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#769-774" title="goto source code">[src]</a></h4><div class="docblock"><p>Get value for the <code>SO_OOBINLINE</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_out_of_band_inline"><code>set_out_of_band_inline</code></a>.</p>
</div><h4 id="method.set_out_of_band_inline" class="method"><code>pub fn <a href="#method.set_out_of_band_inline" class="fnname">set_out_of_band_inline</a>(&amp;self, oob_inline: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#783-792" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_OOBINLINE</code> option on this socket.</p>
<p>If this option is enabled, out-of-band data is directly placed into the
receive data stream. Otherwise, out-of-band data is passed only when the
<code>MSG_OOB</code> flag is set during receiving. As per RFC6093, TCP sockets
using the Urgent mechanism are encouraged to set this flag.</p>
</div><h4 id="method.recv_buffer_size" class="method"><code>pub fn <a href="#method.recv_buffer_size" class="fnname">recv_buffer_size</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#799-804" title="goto source code">[src]</a></h4><div class="docblock"><p>Get value for the <code>SO_RCVBUF</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_recv_buffer_size"><code>set_recv_buffer_size</code></a>.</p>
</div><h4 id="method.set_recv_buffer_size" class="method"><code>pub fn <a href="#method.set_recv_buffer_size" class="fnname">set_recv_buffer_size</a>(&amp;self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#810-812" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_RCVBUF</code> option on this socket.</p>
<p>Changes the size of the operating system's receive buffer associated
with the socket.</p>
</div><h4 id="method.read_timeout" class="method"><code>pub fn <a href="#method.read_timeout" class="fnname">read_timeout</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::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;&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#818-820" title="goto source code">[src]</a></h4><div class="docblock"><p>Get value for the <code>SO_RCVTIMEO</code> option on this socket.</p>
<p>If the returned timeout is <code>None</code>, then <code>read</code> and <code>recv</code> calls will
block indefinitely.</p>
</div><h4 id="method.set_read_timeout" class="method"><code>pub fn <a href="#method.set_read_timeout" class="fnname">set_read_timeout</a>(&amp;self, duration: <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="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#826-828" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_RCVTIMEO</code> option on this socket.</p>
<p>If <code>timeout</code> is <code>None</code>, then <code>read</code> and <code>recv</code> calls will block
indefinitely.</p>
</div><h4 id="method.reuse_address" class="method"><code>pub fn <a href="#method.reuse_address" class="fnname">reuse_address</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#835-840" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>SO_REUSEADDR</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_reuse_address"><code>set_reuse_address</code></a>.</p>
</div><h4 id="method.set_reuse_address" class="method"><code>pub fn <a href="#method.set_reuse_address" class="fnname">set_reuse_address</a>(&amp;self, reuse: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#847-856" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_REUSEADDR</code> option on this socket.</p>
<p>This indicates that futher calls to <code>bind</code> may allow reuse of local
addresses. For IPv4 sockets this means that a socket may bind even when
there's a socket already listening on this port.</p>
</div><h4 id="method.send_buffer_size" class="method"><code>pub fn <a href="#method.send_buffer_size" class="fnname">send_buffer_size</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#863-868" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>SO_SNDBUF</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_send_buffer_size"><code>set_send_buffer_size</code></a>.</p>
</div><h4 id="method.set_send_buffer_size" class="method"><code>pub fn <a href="#method.set_send_buffer_size" class="fnname">set_send_buffer_size</a>(&amp;self, size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#874-876" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_SNDBUF</code> option on this socket.</p>
<p>Changes the size of the operating system's send buffer associated with
the socket.</p>
</div><h4 id="method.write_timeout" class="method"><code>pub fn <a href="#method.write_timeout" class="fnname">write_timeout</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::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;&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#882-884" title="goto source code">[src]</a></h4><div class="docblock"><p>Get value for the <code>SO_SNDTIMEO</code> option on this socket.</p>
<p>If the returned timeout is <code>None</code>, then <code>write</code> and <code>send</code> calls will
block indefinitely.</p>
</div><h4 id="method.set_write_timeout" class="method"><code>pub fn <a href="#method.set_write_timeout" class="fnname">set_write_timeout</a>(&amp;self, duration: <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="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#890-892" title="goto source code">[src]</a></h4><div class="docblock"><p>Set value for the <code>SO_SNDTIMEO</code> option on this socket.</p>
<p>If <code>timeout</code> is <code>None</code>, then <code>write</code> and <code>send</code> calls will block
indefinitely.</p>
</div></div><h3 id="impl-2" class="impl"><code class="in-band">impl <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-2" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#921-1044" title="goto source code">[src]</a></h3><div class="docblock"><p>Socket options for IPv4 sockets, get/set using <code>IPPROTO_IP</code>.</p>
<p>Additional documentation can be found in documentation of the OS.</p>
<ul>
<li>Linux: <a href="https://man7.org/linux/man-pages/man7/ip.7.html">https://man7.org/linux/man-pages/man7/ip.7.html</a></li>
<li>Windows: <a href="https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options">https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options</a></li>
</ul>
</div><div class="impl-items"><h4 id="method.join_multicast_v4" class="method"><code>pub fn <a href="#method.join_multicast_v4" class="fnname">join_multicast_v4</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;multiaddr: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;interface: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#929-935" title="goto source code">[src]</a></h4><div class="docblock"><p>Join a multicast group using <code>IP_ADD_MEMBERSHIP</code> option on this socket.</p>
<p>This function specifies a new multicast group for this socket to join.
The address must be a valid multicast address, and <code>interface</code> is the
address of the local interface with which the system should join the
multicast group. If it's <a href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html#associatedconstant.UNSPECIFIED" title="Ipv4Addr::UNSPECIFIED"><code>Ipv4Addr::UNSPECIFIED</code></a> (<code>INADDR_ANY</code>) then
an appropriate interface is chosen by the system.</p>
</div><h4 id="method.leave_multicast_v4" class="method"><code>pub fn <a href="#method.leave_multicast_v4" class="fnname">leave_multicast_v4</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;multiaddr: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;interface: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#942-948" title="goto source code">[src]</a></h4><div class="docblock"><p>Leave a multicast group using <code>IP_DROP_MEMBERSHIP</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.join_multicast_v4"><code>join_multicast_v4</code></a>.</p>
</div><h4 id="method.multicast_if_v4" class="method"><code>pub fn <a href="#method.multicast_if_v4" class="fnname">multicast_if_v4</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#955-959" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IP_MULTICAST_IF</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_multicast_if_v4"><code>set_multicast_if_v4</code></a>.</p>
</div><h4 id="method.set_multicast_if_v4" class="method"><code>pub fn <a href="#method.set_multicast_if_v4" class="fnname">set_multicast_if_v4</a>(&amp;self, interface: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#964-967" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IP_MULTICAST_IF</code> option for this socket.</p>
<p>Specifies the interface to use for routing multicast packets.</p>
</div><h4 id="method.multicast_loop_v4" class="method"><code>pub fn <a href="#method.multicast_loop_v4" class="fnname">multicast_loop_v4</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#974-979" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IP_MULTICAST_LOOP</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_multicast_loop_v4"><code>set_multicast_loop_v4</code></a>.</p>
</div><h4 id="method.set_multicast_loop_v4" class="method"><code>pub fn <a href="#method.set_multicast_loop_v4" class="fnname">set_multicast_loop_v4</a>(&amp;self, loop_v4: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#985-994" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IP_MULTICAST_LOOP</code> option for this socket.</p>
<p>If enabled, multicast packets will be looped back to the local socket.
Note that this may not have any affect on IPv6 sockets.</p>
</div><h4 id="method.multicast_ttl_v4" class="method"><code>pub fn <a href="#method.multicast_ttl_v4" class="fnname">multicast_ttl_v4</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1001-1006" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IP_MULTICAST_TTL</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_multicast_ttl_v4"><code>set_multicast_ttl_v4</code></a>.</p>
</div><h4 id="method.set_multicast_ttl_v4" class="method"><code>pub fn <a href="#method.set_multicast_ttl_v4" class="fnname">set_multicast_ttl_v4</a>(&amp;self, ttl: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1015-1024" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IP_MULTICAST_TTL</code> option for this socket.</p>
<p>Indicates the time-to-live value of outgoing multicast packets for
this socket. The default value is 1 which means that multicast packets
don't leave the local network unless explicitly requested.</p>
<p>Note that this may not have any affect on IPv6 sockets.</p>
</div><h4 id="method.ttl" class="method"><code>pub fn <a href="#method.ttl" class="fnname">ttl</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1031-1035" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IP_TTL</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_ttl"><code>set_ttl</code></a>.</p>
</div><h4 id="method.set_ttl" class="method"><code>pub fn <a href="#method.set_ttl" class="fnname">set_ttl</a>(&amp;self, ttl: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1041-1043" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IP_TTL</code> option for this socket.</p>
<p>This value sets the time-to-live field that is used in every packet sent
from this socket.</p>
</div></div><h3 id="impl-3" class="impl"><code class="in-band">impl <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-3" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1051-1235" title="goto source code">[src]</a></h3><div class="docblock"><p>Socket options for IPv6 sockets, get/set using <code>IPPROTO_IPV6</code>.</p>
<p>Additional documentation can be found in documentation of the OS.</p>
<ul>
<li>Linux: <a href="https://man7.org/linux/man-pages/man7/ipv6.7.html">https://man7.org/linux/man-pages/man7/ipv6.7.html</a></li>
<li>Windows: <a href="https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options">https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options</a></li>
</ul>
</div><div class="impl-items"><h4 id="method.join_multicast_v6" class="method"><code>pub fn <a href="#method.join_multicast_v6" class="fnname">join_multicast_v6</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;multiaddr: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv6Addr.html" title="struct std::net::ip::Ipv6Addr">Ipv6Addr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;interface: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1059-1073" title="goto source code">[src]</a></h4><div class="docblock"><p>Join a multicast group using <code>IPV6_ADD_MEMBERSHIP</code> option on this socket.</p>
<p>Some OSs use <code>IPV6_JOIN_GROUP</code> for this option.</p>
<p>This function specifies a new multicast group for this socket to join.
The address must be a valid multicast address, and <code>interface</code> is the
index of the interface to join/leave (or 0 to indicate any interface).</p>
</div><h4 id="method.leave_multicast_v6" class="method"><code>pub fn <a href="#method.leave_multicast_v6" class="fnname">leave_multicast_v6</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self, <br>&nbsp;&nbsp;&nbsp;&nbsp;multiaddr: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv6Addr.html" title="struct std::net::ip::Ipv6Addr">Ipv6Addr</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;interface: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1082-1096" title="goto source code">[src]</a></h4><div class="docblock"><p>Leave a multicast group using <code>IPV6_DROP_MEMBERSHIP</code> option on this socket.</p>
<p>Some OSs use <code>IPV6_LEAVE_GROUP</code> for this option.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.join_multicast_v6"><code>join_multicast_v6</code></a>.</p>
</div><h4 id="method.multicast_hops_v6" class="method"><code>pub fn <a href="#method.multicast_hops_v6" class="fnname">multicast_hops_v6</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1103-1108" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IPV6_MULTICAST_HOPS</code> option for this socket</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_multicast_hops_v6"><code>set_multicast_hops_v6</code></a>.</p>
</div><h4 id="method.set_multicast_hops_v6" class="method"><code>pub fn <a href="#method.set_multicast_hops_v6" class="fnname">set_multicast_hops_v6</a>(&amp;self, hops: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1115-1124" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IPV6_MULTICAST_HOPS</code> option for this socket</p>
<p>Indicates the number of &quot;routers&quot; multicast packets will transit for
this socket. The default value is 1 which means that multicast packets
don't leave the local network unless explicitly requested.</p>
</div><h4 id="method.multicast_if_v6" class="method"><code>pub fn <a href="#method.multicast_if_v6" class="fnname">multicast_if_v6</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1131-1136" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IPV6_MULTICAST_IF</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_multicast_if_v6"><code>set_multicast_if_v6</code></a>.</p>
</div><h4 id="method.set_multicast_if_v6" class="method"><code>pub fn <a href="#method.set_multicast_if_v6" class="fnname">set_multicast_if_v6</a>(&amp;self, interface: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1143-1152" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IPV6_MULTICAST_IF</code> option for this socket.</p>
<p>Specifies the interface to use for routing multicast packets. Unlike
ipv4, this is generally required in ipv6 contexts where network routing
prefixes may overlap.</p>
</div><h4 id="method.multicast_loop_v6" class="method"><code>pub fn <a href="#method.multicast_loop_v6" class="fnname">multicast_loop_v6</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1159-1164" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IPV6_MULTICAST_LOOP</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_multicast_loop_v6"><code>set_multicast_loop_v6</code></a>.</p>
</div><h4 id="method.set_multicast_loop_v6" class="method"><code>pub fn <a href="#method.set_multicast_loop_v6" class="fnname">set_multicast_loop_v6</a>(&amp;self, loop_v6: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1170-1179" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value of the <code>IPV6_MULTICAST_LOOP</code> option for this socket.</p>
<p>Controls whether this socket sees the multicast packets it sends itself.
Note that this may not have any affect on IPv4 sockets.</p>
</div><h4 id="method.unicast_hops_v6" class="method"><code>pub fn <a href="#method.unicast_hops_v6" class="fnname">unicast_hops_v6</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1184-1189" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IPV6_UNICAST_HOPS</code> option for this socket.</p>
<p>Specifies the hop limit for ipv6 unicast packets</p>
</div><h4 id="method.set_unicast_hops_v6" class="method"><code>pub fn <a href="#method.set_unicast_hops_v6" class="fnname">set_unicast_hops_v6</a>(&amp;self, hops: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1194-1203" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value for the <code>IPV6_UNICAST_HOPS</code> option on this socket.</p>
<p>Specifies the hop limit for ipv6 unicast packets</p>
</div><h4 id="method.only_v6" class="method"><code>pub fn <a href="#method.only_v6" class="fnname">only_v6</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1210-1215" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>IPV6_V6ONLY</code> option for this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_only_v6"><code>set_only_v6</code></a>.</p>
</div><h4 id="method.set_only_v6" class="method"><code>pub fn <a href="#method.set_only_v6" class="fnname">set_only_v6</a>(&amp;self, only_v6: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1225-1234" title="goto source code">[src]</a></h4><div class="docblock"><p>Set the value for the <code>IPV6_V6ONLY</code> option on this socket.</p>
<p>If this is set to <code>true</code> then the socket is restricted to sending and
receiving IPv6 packets only. In this case two IPv4 and IPv6 applications
can bind the same port at the same time.</p>
<p>If this is set to <code>false</code> then the socket can be used to send and
receive packets from an IPv4-mapped IPv6 address.</p>
</div></div><h3 id="impl-4" class="impl"><code class="in-band">impl <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-4" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1242-1375" title="goto source code">[src]</a></h3><div class="docblock"><p>Socket options for TCP sockets, get/set using <code>IPPROTO_TCP</code>.</p>
<p>Additional documentation can be found in documentation of the OS.</p>
<ul>
<li>Linux: <a href="https://man7.org/linux/man-pages/man7/tcp.7.html">https://man7.org/linux/man-pages/man7/tcp.7.html</a></li>
<li>Windows: <a href="https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options">https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options</a></li>
</ul>
</div><div class="impl-items"><h4 id="method.set_tcp_keepalive" class="method"><code>pub fn <a href="#method.set_tcp_keepalive" class="fnname">set_tcp_keepalive</a>(&amp;self, params: &amp;<a class="struct" href="../socket2/struct.TcpKeepalive.html" title="struct socket2::TcpKeepalive">TcpKeepalive</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1341-1344" title="goto source code">[src]</a></h4><div class="docblock"><p>Set parameters configuring TCP keepalive probes for this socket.</p>
<p>The supported parameters depend on the operating system, and are
configured using the <a href="../socket2/struct.TcpKeepalive.html" title="TcpKeepalive"><code>TcpKeepalive</code></a> struct. At a minimum, all systems
support configuring the <a href="../socket2/struct.TcpKeepalive.html#method.with_time">keepalive time</a>: the time after which the OS
will start sending keepalive messages on an idle connection.</p>
<h1 id="notes-7" class="section-header"><a href="#notes-7">Notes</a></h1>
<ul>
<li>This will enable <code>SO_KEEPALIVE</code> on this socket, if it is not already
enabled.</li>
<li>On some platforms, such as Windows, any keepalive parameters <em>not</em>
configured by the <code>TcpKeepalive</code> struct passed to this function may be
overwritten with their default values. Therefore, this function should
either only be called once per socket, or the same parameters should
be passed every time it is called.</li>
</ul>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<div class="example-wrap"><pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">time</span>::<span class="ident">Duration</span>;
<span class="kw">use</span> <span class="ident">socket2</span>::{<span class="ident">Socket</span>, <span class="ident">TcpKeepalive</span>, <span class="ident">Domain</span>, <span class="ident">Type</span>};
<span class="kw">let</span> <span class="ident">socket</span> <span class="op">=</span> <span class="ident">Socket</span>::<span class="ident">new</span>(<span class="ident">Domain</span>::<span class="ident">IPV4</span>, <span class="ident">Type</span>::<span class="ident">STREAM</span>, <span class="prelude-val">None</span>)<span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">keepalive</span> <span class="op">=</span> <span class="ident">TcpKeepalive</span>::<span class="ident">new</span>()
.<span class="ident">with_time</span>(<span class="ident">Duration</span>::<span class="ident">from_secs</span>(<span class="number">4</span>));
<span class="comment">// Depending on the target operating system, we may also be able to</span>
<span class="comment">// configure the keepalive probe interval and/or the number of</span>
<span class="comment">// retries here as well.</span>
<span class="ident">socket</span>.<span class="ident">set_tcp_keepalive</span>(<span class="kw-2">&amp;</span><span class="ident">keepalive</span>)<span class="question-mark">?</span>;</pre></div>
</div><h4 id="method.nodelay" class="method"><code>pub fn <a href="#method.nodelay" class="fnname">nodelay</a>(&amp;self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1351-1356" title="goto source code">[src]</a></h4><div class="docblock"><p>Get the value of the <code>TCP_NODELAY</code> option on this socket.</p>
<p>For more information about this option, see <a href="../socket2/struct.Socket.html#method.set_nodelay"><code>set_nodelay</code></a>.</p>
</div><h4 id="method.set_nodelay" class="method"><code>pub fn <a href="#method.set_nodelay" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1365-1374" title="goto source code">[src]</a></h4><div class="docblock"><p>Set 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>
</div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><h3 id="impl-AsRawFd" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.AsRawFd.html" title="trait std::sys::unix::ext::io::AsRawFd">AsRawFd</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-AsRawFd" class="anchor"></a><a class="srclink" href="../src/socket2/sys/unix.rs.html#1411-1415" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.as_raw_fd" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.AsRawFd.html#tymethod.as_raw_fd" class="fnname">as_raw_fd</a>(&amp;self) -&gt; <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a></code><a class="srclink" href="../src/socket2/sys/unix.rs.html#1412-1414" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Extracts the raw file descriptor. <a href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.AsRawFd.html#tymethod.as_raw_fd">Read more</a></p>
</div></div><h3 id="impl-Debug" class="impl"><code class="in-band">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="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1441-1449" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.fmt" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &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="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class="srclink" href="../src/socket2/socket.rs.html#1442-1448" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>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></p>
</div></div><h3 id="impl-Drop" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Drop" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1458-1462" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.drop" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop" class="fnname">drop</a>(&amp;mut self)</code><a class="srclink" href="../src/socket2/socket.rs.html#1459-1461" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Executes the destructor for this type. <a href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></p>
</div></div><h3 id="impl-From%3CTcpListener%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>&gt; for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-From%3CTcpListener%3E" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1452" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>) -&gt; <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></code><a class="srclink" href="../src/socket2/socket.rs.html#1452" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-From%3CTcpStream%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<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; for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-From%3CTcpStream%3E" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1451" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <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="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></code><a class="srclink" href="../src/socket2/socket.rs.html#1451" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-From%3CUdpSocket%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/net/udp/struct.UdpSocket.html" title="struct std::net::udp::UdpSocket">UdpSocket</a>&gt; for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-From%3CUdpSocket%3E" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1453" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-2" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/udp/struct.UdpSocket.html" title="struct std::net::udp::UdpSocket">UdpSocket</a>) -&gt; <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></code><a class="srclink" href="../src/socket2/socket.rs.html#1453" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-FromRawFd" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.FromRawFd.html" title="trait std::sys::unix::ext::io::FromRawFd">FromRawFd</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-FromRawFd" class="anchor"></a><a class="srclink" href="../src/socket2/sys/unix.rs.html#1425-1429" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from_raw_fd" class="method hidden"><code>unsafe fn <a href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.FromRawFd.html#tymethod.from_raw_fd" class="fnname">from_raw_fd</a>(fd: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>) -&gt; <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a><span class="notable-traits"><span class="notable-traits-tooltip"><div class="notable-traits-tooltiptext"><span class="docblock"><h3 class="notable">Notable traits for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></h3><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></code><a class="srclink" href="../src/socket2/sys/unix.rs.html#1426-1428" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Constructs a new instance of <code>Self</code> from the given raw file
descriptor. <a href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.FromRawFd.html#tymethod.from_raw_fd">Read more</a></p>
</div></div><h3 id="impl-IntoRawFd" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.IntoRawFd.html" title="trait std::sys::unix::ext::io::IntoRawFd">IntoRawFd</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-IntoRawFd" class="anchor"></a><a class="srclink" href="../src/socket2/sys/unix.rs.html#1417-1423" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into_raw_fd" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.IntoRawFd.html#tymethod.into_raw_fd" class="fnname">into_raw_fd</a>(self) -&gt; <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a></code><a class="srclink" href="../src/socket2/sys/unix.rs.html#1418-1422" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Consumes this object, returning the raw underlying file descriptor. <a href="https://doc.rust-lang.org/nightly/std/sys/unix/ext/io/trait.IntoRawFd.html#tymethod.into_raw_fd">Read more</a></p>
</div></div><h3 id="impl-Read" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Read" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1377-1394" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.read" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read" class="fnname">read</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1378-1383" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Pull some bytes from this source into the specified buffer, returning
how many bytes were read. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read">Read more</a></p>
</div><h4 id="method.read_vectored" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored" class="fnname">read_vectored</a>(&amp;mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1386-1393" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Like <code>read</code>, except that it reads into a slice of buffers. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored">Read more</a></p>
</div><h4 id="method.is_read_vectored" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.is_read_vectored" class="fnname">is_read_vectored</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#605" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock hidden'><p>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
implementation. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.is_read_vectored">Read more</a></p>
</div><h4 id="method.initializer" class="method hidden"><code>pub unsafe fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.initializer" class="fnname">initializer</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Initializer.html" title="struct std::io::Initializer">Initializer</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#630" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>read_initializer</code>)</div></div><div class='docblock hidden'><p>Determines if this <code>Read</code>er can work with buffers of uninitialized
memory. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.initializer">Read more</a></p>
</div><h4 id="method.read_to_end" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_end" class="fnname">read_to_end</a>(&amp;mut self, buf: &amp;mut <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>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</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.usize.html">usize</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;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#681" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_end">Read more</a></p>
</div><h4 id="method.read_to_string" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_string" class="fnname">read_to_string</a>(&amp;mut self, buf: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</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.usize.html">usize</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;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#724" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_string">Read more</a></p>
</div><h4 id="method.read_exact" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact" class="fnname">read_exact</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</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;</code><span class="since" title="Stable since Rust version 1.6.0">1.6.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#788" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact">Read more</a></p>
</div><h4 id="method.by_ref" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.by_ref" class="fnname">by_ref</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#827-829" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates a &quot;by reference&quot; adaptor for this instance of <code>Read</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.by_ref">Read more</a></p>
</div><h4 id="method.bytes" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.bytes" class="fnname">bytes</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a>&lt;Self&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#864-866" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Transforms this <code>Read</code> instance to an <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="Iterator"><code>Iterator</code></a> over its bytes. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.bytes">Read more</a></p>
</div><h4 id="method.chain" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.chain" class="fnname">chain</a>&lt;R&gt;(self, next: R) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a>&lt;Self, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#902-904" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an adaptor which will chain this stream with another. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.chain">Read more</a></p>
</div><h4 id="method.take" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.take" class="fnname">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Take.html" title="struct std::io::Take">Take</a>&lt;Self&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#941-943" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an adaptor which will read at most <code>limit</code> bytes from it. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.take">Read more</a></p>
</div></div><h3 id="impl-Read-1" class="impl"><code class="in-band">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Read-1" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1396-1409" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.read-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read" class="fnname">read</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1397-1401" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Pull some bytes from this source into the specified buffer, returning
how many bytes were read. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read">Read more</a></p>
</div><h4 id="method.read_vectored-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored" class="fnname">read_vectored</a>(&amp;mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1404-1408" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Like <code>read</code>, except that it reads into a slice of buffers. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_vectored">Read more</a></p>
</div><h4 id="method.is_read_vectored-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.is_read_vectored" class="fnname">is_read_vectored</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#605" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock hidden'><p>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
implementation. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.is_read_vectored">Read more</a></p>
</div><h4 id="method.initializer-1" class="method hidden"><code>pub unsafe fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.initializer" class="fnname">initializer</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Initializer.html" title="struct std::io::Initializer">Initializer</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#630" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>read_initializer</code>)</div></div><div class='docblock hidden'><p>Determines if this <code>Read</code>er can work with buffers of uninitialized
memory. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.initializer">Read more</a></p>
</div><h4 id="method.read_to_end-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_end" class="fnname">read_to_end</a>(&amp;mut self, buf: &amp;mut <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>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</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.usize.html">usize</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;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#681" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_end">Read more</a></p>
</div><h4 id="method.read_to_string-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_string" class="fnname">read_to_string</a>(&amp;mut self, buf: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</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.usize.html">usize</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;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#724" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_to_string">Read more</a></p>
</div><h4 id="method.read_exact-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact" class="fnname">read_exact</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</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;</code><span class="since" title="Stable since Rust version 1.6.0">1.6.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#788" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact">Read more</a></p>
</div><h4 id="method.by_ref-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.by_ref" class="fnname">by_ref</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#827-829" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates a &quot;by reference&quot; adaptor for this instance of <code>Read</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.by_ref">Read more</a></p>
</div><h4 id="method.bytes-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.bytes" class="fnname">bytes</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a>&lt;Self&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#864-866" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Transforms this <code>Read</code> instance to an <a href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="Iterator"><code>Iterator</code></a> over its bytes. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.bytes">Read more</a></p>
</div><h4 id="method.chain-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.chain" class="fnname">chain</a>&lt;R&gt;(self, next: R) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a>&lt;Self, R&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;R: <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html" title="trait std::io::Read">Read</a>,&nbsp;</span></code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#902-904" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an adaptor which will chain this stream with another. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.chain">Read more</a></p>
</div><h4 id="method.take-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.take" class="fnname">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.Take.html" title="struct std::io::Take">Take</a>&lt;Self&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#941-943" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates an adaptor which will read at most <code>limit</code> bytes from it. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.take">Read more</a></p>
</div></div><h3 id="impl-Write" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Write" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1411-1424" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.write" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write" class="fnname">write</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1412-1414" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Write a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write">Read more</a></p>
</div><h4 id="method.write_vectored" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored" class="fnname">write_vectored</a>(&amp;mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1417-1419" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Like <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write"><code>write</code></a>, except that it writes from a slice of buffers. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored">Read more</a></p>
</div><h4 id="method.flush" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.flush" class="fnname">flush</a>(&amp;mut self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1421-1423" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.flush">Read more</a></p>
</div><h4 id="method.is_write_vectored" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.is_write_vectored" class="fnname">is_write_vectored</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1370" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock hidden'><p>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored"><code>write_vectored</code></a>
implementation. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.is_write_vectored">Read more</a></p>
</div><h4 id="method.write_all" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all" class="fnname">write_all</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</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;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1432" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all">Read more</a></p>
</div><h4 id="method.write_all_vectored" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all_vectored" class="fnname">write_all_vectored</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -&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;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1494" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>write_all_vectored</code>)</div></div><div class='docblock hidden'><p>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all_vectored">Read more</a></p>
</div><h4 id="method.write_fmt" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_fmt" class="fnname">write_fmt</a>(&amp;mut self, fmt: <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</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/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1547" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Writes a formatted string into this writer, returning any error
encountered. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_fmt">Read more</a></p>
</div><h4 id="method.by_ref-2" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.by_ref" class="fnname">by_ref</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1603-1605" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates a &quot;by reference&quot; adaptor for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.by_ref">Read more</a></p>
</div></div><h3 id="impl-Write-1" class="impl"><code class="in-band">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &amp;'a <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Write-1" class="anchor"></a><a class="srclink" href="../src/socket2/socket.rs.html#1426-1439" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.write-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write" class="fnname">write</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1427-1429" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Write a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write">Read more</a></p>
</div><h4 id="method.write_vectored-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored" class="fnname">write_vectored</a>(&amp;mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1432-1434" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Like <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.write"><code>write</code></a>, except that it writes from a slice of buffers. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored">Read more</a></p>
</div><h4 id="method.flush-1" class="method hidden"><code>fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.flush" class="fnname">flush</a>(&amp;mut self) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code><a class="srclink" href="../src/socket2/socket.rs.html#1436-1438" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#tymethod.flush">Read more</a></p>
</div><h4 id="method.is_write_vectored-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.is_write_vectored" class="fnname">is_write_vectored</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1370" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock hidden'><p>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_vectored"><code>write_vectored</code></a>
implementation. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.is_write_vectored">Read more</a></p>
</div><h4 id="method.write_all-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all" class="fnname">write_all</a>(&amp;mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</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;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1432" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all">Read more</a></p>
</div><h4 id="method.write_all_vectored-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all_vectored" class="fnname">write_all_vectored</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;bufs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&amp;mut [</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a>&lt;'_&gt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a><br>) -&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;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1494" title="goto source code">[src]</a></h4><div class="item-info hidden"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>write_all_vectored</code>)</div></div><div class='docblock hidden'><p>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_all_vectored">Read more</a></p>
</div><h4 id="method.write_fmt-1" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_fmt" class="fnname">write_fmt</a>(&amp;mut self, fmt: <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</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/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1547" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Writes a formatted string into this writer, returning any error
encountered. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.write_fmt">Read more</a></p>
</div><h4 id="method.by_ref-3" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.by_ref" class="fnname">by_ref</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>Self</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/io/mod.rs.html#1603-1605" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Creates a &quot;by reference&quot; adaptor for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/nightly/std/io/trait.Write.html#method.by_ref">Read more</a></p>
</div></div></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"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a><a class="srclink" href="../src/socket2/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Send" class="impl"><code class="in-band">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="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Send" class="anchor"></a><a class="srclink" href="../src/socket2/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Sync" class="impl"><code class="in-band">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="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Sync" class="anchor"></a><a class="srclink" href="../src/socket2/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-Unpin" class="impl"><code class="in-band">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="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-Unpin" class="anchor"></a><a class="srclink" href="../src/socket2/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../socket2/struct.Socket.html" title="struct socket2::Socket">Socket</a></code><a href="#impl-UnwindSafe" class="anchor"></a><a class="srclink" href="../src/socket2/lib.rs.html#1" title="goto source code">[src]</a></h3><div class="impl-items"></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><h3 id="impl-Any" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.type_id" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">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></code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>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></p>
</div></div><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#207-211" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-218" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#215" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>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></p>
</div></div><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">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</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-549" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.from-3" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-Into%3CU%3E" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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;,&nbsp;</span></code><a href="#impl-Into%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#534-541" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="method.into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#538" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-TryFrom%3CU%3E" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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;,&nbsp;</span></code><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#582-591" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_from" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#588" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3 id="impl-TryInto%3CU%3E" class="impl"><code class="in-band">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 <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;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;,&nbsp;</span></code><a href="#impl-TryInto%3CU%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#568-577" title="goto source code">[src]</a></h3><div class="impl-items"><h4 id="associatedtype.Error-1" class="type"><code>type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></code></h4><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4 id="method.try_into" class="method hidden"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">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="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</code><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#574" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></div></section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="socket2"></div>
<script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>