650 lines
268 KiB
HTML
650 lines
268 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Owned wrapper around a system socket."><meta name="keywords" content="rust, rustlang, rust-lang, Socket"><title>Socket in socket2 - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><script defer src="../main.js"></script>
|
||
<noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../socket2/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.png" alt="logo"></div>
|
||
</a><h2 class="location">Struct Socket</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.accept">accept</a><a href="#method.accept4">accept4</a><a href="#method.accept_raw">accept_raw</a><a href="#method.attach_filter">attach_filter</a><a href="#method.bind">bind</a><a href="#method.bind_device">bind_device</a><a href="#method.broadcast">broadcast</a><a href="#method.connect">connect</a><a href="#method.connect_timeout">connect_timeout</a><a href="#method.cork">cork</a><a href="#method.cpu_affinity">cpu_affinity</a><a href="#method.detach_filter">detach_filter</a><a href="#method.device">device</a><a href="#method.domain">domain</a><a href="#method.freebind">freebind</a><a href="#method.freebind_ipv6">freebind_ipv6</a><a href="#method.header_included">header_included</a><a href="#method.ip_transparent">ip_transparent</a><a href="#method.is_listener">is_listener</a><a href="#method.join_multicast_v4">join_multicast_v4</a><a href="#method.join_multicast_v4_n">join_multicast_v4_n</a><a href="#method.join_multicast_v6">join_multicast_v6</a><a href="#method.keepalive">keepalive</a><a href="#method.keepalive_interval">keepalive_interval</a><a href="#method.keepalive_retries">keepalive_retries</a><a href="#method.keepalive_time">keepalive_time</a><a href="#method.leave_multicast_v4">leave_multicast_v4</a><a href="#method.leave_multicast_v4_n">leave_multicast_v4_n</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.mark">mark</a><a href="#method.mss">mss</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.pair">pair</a><a href="#method.pair_raw">pair_raw</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.protocol">protocol</a><a href="#method.quickack">quickack</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.reuse_port">reuse_port</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.sendfile">sendfile</a><a href="#method.set_broadcast">set_broadcast</a><a href="#method.set_cloexec">set_cloexec</a><a href="#method.set_cork">set_cork</a><a href="#method.set_cpu_affinity">set_cpu_affinity</a><a href="#method.set_freebind">set_freebind</a><a href="#method.set_freebind_ipv6">set_freebind_ipv6</a><a href="#method.set_header_included">set_header_included</a><a href="#method.set_ip_transparent">set_ip_transparent</a><a href="#method.set_keepalive">set_keepalive</a><a href="#method.set_linger">set_linger</a><a href="#method.set_mark">set_mark</a><a href="#method.set_mss">set_mss</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_nosigpipe">set_nosigpipe</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_quickack">set_quickack</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_reuse_port">set_reuse_port</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_tcp_user_timeout">set_tcp_user_timeout</a><a href="#method.set_thin_linear_timeouts">set_thin_linear_timeouts</a><a href="#method.set_tos">set_tos</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.tcp_user_timeout">tcp_user_timeout</a><a href="#method.thin_linear_timeouts">thin_linear_timeouts</a><a href="#method.tos">tos</a><a href="#method.try_clone">try_clone</a><a href="#method.ttl">ttl</a><a href="#method.type">type</a><a href="#method.unicast_hops_v6">unicast_hops_v6</a><a href="#method.write_timeout">write_timeout</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-AsRawFd">AsRawFd</a><a href="#impl-Debug">Debug</a><a href="#impl-From%3CSocket%3E">From<Socket></a><a href="#impl-From%3CTcpListener%3E">From<TcpListener></a><a href="#impl-From%3CTcpStream%3E">From<TcpStream></a><a href="#impl-From%3CUdpSocket%3E">From<UdpSocket></a><a href="#impl-From%3CUnixDatagram%3E">From<UnixDatagram></a><a href="#impl-From%3CUnixListener%3E">From<UnixListener></a><a href="#impl-From%3CUnixStream%3E">From<UnixStream></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><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><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><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><h2 class="location">Other items in<br><a href="index.html">socket2</a></h2><div id="sidebar-vars" data-name="Socket" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../socket2/index.html"><img class="rust-logo" src="../rust-logo.png" alt="logo"></a><nav class="sub"><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><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" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">socket2</a>::<wbr><a class="struct" href="#">Socket</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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">−</span>]</a></span><a class="srclink" href="../src/socket2/socket.rs.html#72-74" title="goto source code">[src]</a></span></h1><div class="docblock item-decl"><pre class="rust struct"><code>pub struct Socket { /* fields omitted */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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 “Rustic
|
||
translation” of what’s below.</p>
|
||
<h3 id="converting-to-and-from-other-types" class="section-header"><a href="#converting-to-and-from-other-types">Converting to and from other types</a></h3>
|
||
<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/1.59.0/std/net/tcp/struct.TcpStream.html"><code>TcpStream</code></a> or <a href="https://doc.rust-lang.org/1.59.0/std/net/udp/struct.UdpSocket.html"><code>UdpSocket</code></a>, using the
|
||
<a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="From"><code>From</code></a> trait, see the example below.</p>
|
||
<h2 id="notes" class="section-header"><a href="#notes">Notes</a></h2>
|
||
<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>
|
||
<h2 id="examples" class="section-header"><a href="#examples">Examples</a></h2>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::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::new</span>(<span class="ident">Domain::IPV4</span>, <span class="ident">Type::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">"[::1]:12345"</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">&</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">&</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></code></pre></div>
|
||
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#79-663" title="goto source code">[src]</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.new" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#127-130" title="goto source code">[src]</a></div><a href="#method.new" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>(<br> domain: <a class="struct" href="struct.Domain.html" title="struct socket2::Domain">Domain</a>, <br> ty: <a class="struct" href="struct.Type.html" title="struct socket2::Type">Type</a>, <br> protocol: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>></h4></div></summary><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="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.new_raw" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#136-139" title="goto source code">[src]</a></div><a href="#method.new_raw" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.new_raw" class="fnname">new_raw</a>(<br> domain: <a class="struct" href="struct.Domain.html" title="struct socket2::Domain">Domain</a>, <br> ty: <a class="struct" href="struct.Type.html" title="struct socket2::Type">Type</a>, <br> protocol: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.pair" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#149-159" title="goto source code">[src]</a></div><a href="#method.pair" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.pair" class="fnname">pair</a>(<br> domain: <a class="struct" href="struct.Domain.html" title="struct socket2::Domain">Domain</a>, <br> ty: <a class="struct" href="struct.Type.html" title="struct socket2::Type">Type</a>, <br> protocol: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Creates a pair of sockets which are connected to each other.</p>
|
||
<p>This function corresponds to <code>socketpair(2)</code>.</p>
|
||
<p>This function sets the same flags as in done for <a href="struct.Socket.html#method.new" title="Socket::new"><code>Socket::new</code></a>,
|
||
<a href="struct.Socket.html#method.pair_raw" title="Socket::pair_raw"><code>Socket::pair_raw</code></a> can be used if you don’t want to set those flags.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.pair_raw" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#166-174" title="goto source code">[src]</a></div><a href="#method.pair_raw" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.pair_raw" class="fnname">pair_raw</a>(<br> domain: <a class="struct" href="struct.Domain.html" title="struct socket2::Domain">Domain</a>, <br> ty: <a class="struct" href="struct.Type.html" title="struct socket2::Type">Type</a>, <br> protocol: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Creates a pair of sockets which are connected to each other.</p>
|
||
<p>This function corresponds to <code>socketpair(2)</code>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.bind" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#180-182" title="goto source code">[src]</a></div><a href="#method.bind" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.bind" class="fnname">bind</a>(&self, address: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.connect" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#198-200" title="goto source code">[src]</a></div><a href="#method.connect" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.connect" class="fnname">connect</a>(&self, address: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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>
|
||
<h5 id="notes-1" class="section-header"><a href="#notes-1">Notes</a></h5>
|
||
<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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.connect_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#221-235" title="goto source code">[src]</a></div><a href="#method.connect_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.connect_timeout" class="fnname">connect_timeout</a>(&self, addr: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>, timeout: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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>
|
||
<h5 id="warnings" class="section-header"><a href="#warnings">Warnings</a></h5>
|
||
<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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.listen" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#245-247" title="goto source code">[src]</a></div><a href="#method.listen" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.listen" class="fnname">listen</a>(&self, backlog: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Mark a socket as ready to accept incoming connection requests using
|
||
<a href="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.accept" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#256-290" title="goto source code">[src]</a></div><a href="#method.accept" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.accept" class="fnname">accept</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><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="struct.Socket.html#method.new" title="Socket::new"><code>Socket::new</code></a>,
|
||
<a href="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.accept_raw" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#296-298" title="goto source code">[src]</a></div><a href="#method.accept_raw" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.accept_raw" class="fnname">accept_raw</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.local_addr" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#308-310" title="goto source code">[src]</a></div><a href="#method.local_addr" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.local_addr" class="fnname">local_addr</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>></h4></div></summary><div class="docblock"><p>Returns the socket address of the local half of this socket.</p>
|
||
<h5 id="notes-2" class="section-header"><a href="#notes-2">Notes</a></h5>
|
||
<p>Depending on the OS this may return an error if the socket is not
|
||
<a href="struct.Socket.html#method.bind">bound</a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.peer_addr" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#319-321" title="goto source code">[src]</a></div><a href="#method.peer_addr" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.peer_addr" class="fnname">peer_addr</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>></h4></div></summary><div class="docblock"><p>Returns the socket address of the remote peer of this socket.</p>
|
||
<h5 id="notes-3" class="section-header"><a href="#notes-3">Notes</a></h5>
|
||
<p>This returns an error if the socket is not <a href="struct.Socket.html#method.connect"><code>connect</code>ed</a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#325-327" title="goto source code">[src]</a></div><a href="#method.type" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.type" class="fnname">type</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.Type.html" title="struct socket2::Type">Type</a>></h4></div></summary><div class="docblock"><p>Returns the <a href="struct.Type.html" title="Type"><code>Type</code></a> of this socket by checking the <code>SO_TYPE</code> option on
|
||
this socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_clone" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#342-344" title="goto source code">[src]</a></div><a href="#method.try_clone" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.try_clone" class="fnname">try_clone</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>></h4></div></summary><div class="docblock"><p>Creates a new independently owned handle to the underlying socket.</p>
|
||
<h5 id="notes-4" class="section-header"><a href="#notes-4">Notes</a></h5>
|
||
<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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_nonblocking" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#354-356" title="goto source code">[src]</a></div><a href="#method.set_nonblocking" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_nonblocking" class="fnname">set_nonblocking</a>(&self, nonblocking: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Moves this TCP stream into or out of nonblocking mode.</p>
|
||
<h5 id="notes-5" class="section-header"><a href="#notes-5">Notes</a></h5>
|
||
<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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.shutdown" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#362-364" title="goto source code">[src]</a></div><a href="#method.shutdown" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.shutdown" class="fnname">shutdown</a>(&self, how: <a class="enum" href="https://doc.rust-lang.org/1.59.0/std/net/enum.Shutdown.html" title="enum std::net::Shutdown">Shutdown</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#386-388" title="goto source code">[src]</a></div><a href="#method.recv" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv" class="fnname">recv</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Receives data on the socket from the remote address to which it is
|
||
connected.</p>
|
||
<p>The <a href="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>
|
||
<h5 id="safety" class="section-header"><a href="#safety">Safety</a></h5>
|
||
<p>Normally casting a <code>&mut [u8]</code> to <code>&mut [MaybeUninit<u8>]</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>&mut [u8]</code>.</p>
|
||
<p>Note that the <a href="https://doc.rust-lang.org/1.59.0/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>&mut [u8]</code>, allowing initialised buffers to be used
|
||
without using <code>unsafe</code>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_out_of_band" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#397-399" title="goto source code">[src]</a></div><a href="#method.recv_out_of_band" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_out_of_band" class="fnname">recv_out_of_band</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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="struct.Socket.html#method.recv"><code>recv</code></a>, <a href="struct.Socket.html#method.out_of_band_inline"><code>out_of_band_inline</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#405-411" title="goto source code">[src]</a></div><a href="#method.recv_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_with_flags" class="fnname">recv_with_flags</a>(<br> &self, <br> buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_vectored" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#440-445" title="goto source code">[src]</a></div><a href="#method.recv_vectored" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_vectored" class="fnname">recv_vectored</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Receives data on the socket from the remote address to which it is
|
||
connected. Unlike <a href="struct.Socket.html#method.recv"><code>recv</code></a> this allows passing multiple buffers.</p>
|
||
<p>The <a href="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="struct.RecvFlags.html" title="RecvFlags"><code>RecvFlags</code></a> for more information about
|
||
the returned flags.</p>
|
||
<h5 id="safety-1" class="section-header"><a href="#safety-1">Safety</a></h5>
|
||
<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>&mut [IoSliceMut]</code>.</p>
|
||
<p>Note that the <a href="https://doc.rust-lang.org/1.59.0/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>&mut [IoSliceMut]</code>, allowing initialised
|
||
buffers to be used without using <code>unsafe</code>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_vectored_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#460-466" title="goto source code">[src]</a></div><a href="#method.recv_vectored_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_vectored_with_flags" class="fnname">recv_vectored_with_flags</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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>
|
||
<h5 id="safety-2" class="section-header"><a href="#safety-2">Safety</a></h5>
|
||
<p><code>recv_from_vectored</code> makes the same safety guarantees regarding <code>bufs</code>
|
||
as <a href="struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.peek" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#481-483" title="goto source code">[src]</a></div><a href="#method.peek" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.peek" class="fnname">peek</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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>
|
||
<h5 id="safety-3" class="section-header"><a href="#safety-3">Safety</a></h5>
|
||
<p><code>peek</code> makes the same safety guarantees regarding the <code>buf</code>fer as
|
||
<a href="struct.Socket.html#method.recv"><code>recv</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_from" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#494-496" title="goto source code">[src]</a></div><a href="#method.recv_from" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_from" class="fnname">recv_from</a>(<br> &self, <br> buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><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>
|
||
<h5 id="safety-4" class="section-header"><a href="#safety-4">Safety</a></h5>
|
||
<p><code>recv_from</code> makes the same safety guarantees regarding the <code>buf</code>fer as
|
||
<a href="struct.Socket.html#method.recv"><code>recv</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_from_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#502-508" title="goto source code">[src]</a></div><a href="#method.recv_from_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_from_with_flags" class="fnname">recv_from_with_flags</a>(<br> &self, <br> buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_from_vectored" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#524-529" title="goto source code">[src]</a></div><a href="#method.recv_from_vectored" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_from_vectored" class="fnname">recv_from_vectored</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Receives data from the socket. Returns the amount of bytes read, the
|
||
<a href="struct.RecvFlags.html" title="RecvFlags"><code>RecvFlags</code></a> and the remote address from the data is coming. Unlike
|
||
<a href="struct.Socket.html#method.recv_from"><code>recv_from</code></a> this allows passing multiple buffers.</p>
|
||
<h5 id="safety-5" class="section-header"><a href="#safety-5">Safety</a></h5>
|
||
<p><code>recv_from_vectored</code> makes the same safety guarantees regarding <code>bufs</code>
|
||
as <a href="struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_from_vectored_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#544-550" title="goto source code">[src]</a></div><a href="#method.recv_from_vectored_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_from_vectored_with_flags" class="fnname">recv_from_vectored_with_flags</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="struct.MaybeUninitSlice.html" title="struct socket2::MaybeUninitSlice">MaybeUninitSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.RecvFlags.html" title="struct socket2::RecvFlags">RecvFlags</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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>
|
||
<h5 id="safety-6" class="section-header"><a href="#safety-6">Safety</a></h5>
|
||
<p><code>recv_from_vectored</code> makes the same safety guarantees regarding <code>bufs</code>
|
||
as <a href="struct.Socket.html#method.recv_vectored"><code>recv_vectored</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.peek_from" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#566-568" title="goto source code">[src]</a></div><a href="#method.peek_from" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.peek_from" class="fnname">peek_from</a>(<br> &self, <br> buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="union" href="https://doc.rust-lang.org/1.59.0/core/mem/maybe_uninit/union.MaybeUninit.html" title="union core::mem::maybe_uninit::MaybeUninit">MaybeUninit</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><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>
|
||
<h5 id="safety-7" class="section-header"><a href="#safety-7">Safety</a></h5>
|
||
<p><code>peek_from</code> makes the same safety guarantees regarding the <code>buf</code>fer as
|
||
<a href="struct.Socket.html#method.recv"><code>recv</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#576-578" title="goto source code">[src]</a></div><a href="#method.send" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send" class="fnname">send</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#584-586" title="goto source code">[src]</a></div><a href="#method.send_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_with_flags" class="fnname">send_with_flags</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/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>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_vectored" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#591-593" title="goto source code">[src]</a></div><a href="#method.send_vectored" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_vectored" class="fnname">send_vectored</a>(&self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Send data to the connected peer. Returns the amount of bytes written.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_vectored_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#601-607" title="goto source code">[src]</a></div><a href="#method.send_vectored_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_vectored_with_flags" class="fnname">send_vectored_with_flags</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_out_of_band" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#616-618" title="goto source code">[src]</a></div><a href="#method.send_out_of_band" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_out_of_band" class="fnname">send_out_of_band</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_to" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#624-626" title="goto source code">[src]</a></div><a href="#method.send_to" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_to" class="fnname">send_to</a>(&self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, addr: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_to_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#632-639" title="goto source code">[src]</a></div><a href="#method.send_to_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_to_with_flags" class="fnname">send_to_with_flags</a>(<br> &self, <br> buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> addr: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_to_vectored" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#645-647" title="goto source code">[src]</a></div><a href="#method.send_to_vectored" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_to_vectored" class="fnname">send_to_vectored</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> addr: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Send data to a peer listening on <code>addr</code>. Returns the amount of bytes
|
||
written.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_to_vectored_with_flags" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#655-662" title="goto source code">[src]</a></div><a href="#method.send_to_vectored_with_flags" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_to_vectored_with_flags" class="fnname">send_to_vectored_with_flags</a>(<br> &self, <br> bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>, <br> addr: &<a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a>, <br> flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Identical to <a href="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></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#740-984" title="goto source code">[src]</a></div><a href="#impl-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><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"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.broadcast" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#746-751" title="goto source code">[src]</a></div><a href="#method.broadcast" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.broadcast" class="fnname">broadcast</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_broadcast"><code>set_broadcast</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_broadcast" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#757-766" title="goto source code">[src]</a></div><a href="#method.set_broadcast" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_broadcast" class="fnname">set_broadcast</a>(&self, broadcast: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.take_error" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#773-779" title="goto source code">[src]</a></div><a href="#method.take_error" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.take_error" class="fnname">take_error</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.keepalive" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#786-791" title="goto source code">[src]</a></div><a href="#method.keepalive" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.keepalive" class="fnname">keepalive</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_keepalive"><code>set_keepalive</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_keepalive" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#796-805" title="goto source code">[src]</a></div><a href="#method.set_keepalive" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_keepalive" class="fnname">set_keepalive</a>(&self, keepalive: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.linger" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#812-817" title="goto source code">[src]</a></div><a href="#method.linger" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.linger" class="fnname">linger</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>></h4></div></summary><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="struct.Socket.html#method.set_linger"><code>set_linger</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_linger" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#833-836" title="goto source code">[src]</a></div><a href="#method.set_linger" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_linger" class="fnname">set_linger</a>(&self, linger: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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>
|
||
<h5 id="notes-6" class="section-header"><a href="#notes-6">Notes</a></h5>
|
||
<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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.out_of_band_inline" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#845-850" title="goto source code">[src]</a></div><a href="#method.out_of_band_inline" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.out_of_band_inline" class="fnname">out_of_band_inline</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_out_of_band_inline"><code>set_out_of_band_inline</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_out_of_band_inline" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#860-869" title="goto source code">[src]</a></div><a href="#method.set_out_of_band_inline" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_out_of_band_inline" class="fnname">set_out_of_band_inline</a>(&self, oob_inline: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.recv_buffer_size" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#876-881" title="goto source code">[src]</a></div><a href="#method.recv_buffer_size" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.recv_buffer_size" class="fnname">recv_buffer_size</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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="struct.Socket.html#method.set_recv_buffer_size"><code>set_recv_buffer_size</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_recv_buffer_size" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#887-896" title="goto source code">[src]</a></div><a href="#method.set_recv_buffer_size" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_recv_buffer_size" class="fnname">set_recv_buffer_size</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#902-904" title="goto source code">[src]</a></div><a href="#method.read_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.read_timeout" class="fnname">read_timeout</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_read_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#910-912" title="goto source code">[src]</a></div><a href="#method.set_read_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_read_timeout" class="fnname">set_read_timeout</a>(&self, duration: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.reuse_address" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#919-924" title="goto source code">[src]</a></div><a href="#method.reuse_address" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.reuse_address" class="fnname">reuse_address</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_reuse_address"><code>set_reuse_address</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_reuse_address" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#931-940" title="goto source code">[src]</a></div><a href="#method.set_reuse_address" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_reuse_address" class="fnname">set_reuse_address</a>(&self, reuse: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.send_buffer_size" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#947-952" title="goto source code">[src]</a></div><a href="#method.send_buffer_size" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.send_buffer_size" class="fnname">send_buffer_size</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><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="struct.Socket.html#method.set_send_buffer_size"><code>set_send_buffer_size</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_send_buffer_size" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#958-967" title="goto source code">[src]</a></div><a href="#method.set_send_buffer_size" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_send_buffer_size" class="fnname">set_send_buffer_size</a>(&self, size: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#973-975" title="goto source code">[src]</a></div><a href="#method.write_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.write_timeout" class="fnname">write_timeout</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_write_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#981-983" title="goto source code">[src]</a></div><a href="#method.set_write_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_write_timeout" class="fnname">set_write_timeout</a>(&self, duration: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-2" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1012-1323" title="goto source code">[src]</a></div><a href="#impl-2" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><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"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.header_included" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1020-1025" title="goto source code">[src]</a></div><a href="#method.header_included" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.header_included" class="fnname">header_included</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>IP_HDRINCL</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_header_included"><code>set_header_included</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_header_included" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1040-1049" title="goto source code">[src]</a></div><a href="#method.set_header_included" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_header_included" class="fnname">set_header_included</a>(&self, included: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>IP_HDRINCL</code> option on this socket.</p>
|
||
<p>If enabled, the user supplies an IP header in front of the user data.
|
||
Valid only for <a href="struct.Type.html#associatedconstant.RAW"><code>SOCK_RAW</code></a> sockets; see <a href="https://man7.org/linux/man-pages/man7/raw.7.html">raw(7)</a> for more information.
|
||
When this flag is enabled, the values set by <code>IP_OPTIONS</code>, <a href="struct.Socket.html#method.set_ttl"><code>IP_TTL</code></a>,
|
||
and <a href="struct.Socket.html#method.set_tos"><code>IP_TOS</code></a> are ignored.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.ip_transparent" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1058-1063" title="goto source code">[src]</a></div><a href="#method.ip_transparent" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.ip_transparent" class="fnname">ip_transparent</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>IP_TRANSPARENT</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_ip_transparent"><code>set_ip_transparent</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_ip_transparent" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1082-1091" title="goto source code">[src]</a></div><a href="#method.set_ip_transparent" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_ip_transparent" class="fnname">set_ip_transparent</a>(&self, transparent: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>IP_TRANSPARENT</code> option on this socket.</p>
|
||
<p>Setting this boolean option enables transparent proxying
|
||
on this socket. This socket option allows the calling
|
||
application to bind to a nonlocal IP address and operate
|
||
both as a client and a server with the foreign address as
|
||
the local endpoint. NOTE: this requires that routing be
|
||
set up in a way that packets going to the foreign address
|
||
are routed through the TProxy box (i.e., the system
|
||
hosting the application that employs the IP_TRANSPARENT
|
||
socket option). Enabling this socket option requires
|
||
superuser privileges (the <code>CAP_NET_ADMIN</code> capability).</p>
|
||
<p>TProxy redirection with the iptables TPROXY target also
|
||
requires that this option be set on the redirected socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.join_multicast_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1100-1106" title="goto source code">[src]</a></div><a href="#method.join_multicast_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.join_multicast_v4" class="fnname">join_multicast_v4</a>(<br> &self, <br> multiaddr: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <br> interface: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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/1.59.0/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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.leave_multicast_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1113-1126" title="goto source code">[src]</a></div><a href="#method.leave_multicast_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.leave_multicast_v4" class="fnname">leave_multicast_v4</a>(<br> &self, <br> multiaddr: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <br> interface: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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="struct.Socket.html#method.join_multicast_v4"><code>join_multicast_v4</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.join_multicast_v4_n" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1141-1155" title="goto source code">[src]</a></div><a href="#method.join_multicast_v4_n" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.join_multicast_v4_n" class="fnname">join_multicast_v4_n</a>(<br> &self, <br> multiaddr: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <br> interface: &<a class="enum" href="enum.InterfaceIndexOrAddress.html" title="enum socket2::InterfaceIndexOrAddress">InterfaceIndexOrAddress</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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> specifies
|
||
the local interface with which the system should join the multicast
|
||
group. See <a href="enum.InterfaceIndexOrAddress.html" title="InterfaceIndexOrAddress"><code>InterfaceIndexOrAddress</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.leave_multicast_v4_n" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1169-1183" title="goto source code">[src]</a></div><a href="#method.leave_multicast_v4_n" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.leave_multicast_v4_n" class="fnname">leave_multicast_v4_n</a>(<br> &self, <br> multiaddr: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <br> interface: &<a class="enum" href="enum.InterfaceIndexOrAddress.html" title="enum socket2::InterfaceIndexOrAddress">InterfaceIndexOrAddress</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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="struct.Socket.html#method.join_multicast_v4_n"><code>join_multicast_v4_n</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.multicast_if_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1190-1194" title="goto source code">[src]</a></div><a href="#method.multicast_if_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.multicast_if_v4" class="fnname">multicast_if_v4</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>></h4></div></summary><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="struct.Socket.html#method.set_multicast_if_v4"><code>set_multicast_if_v4</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_multicast_if_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1199-1209" title="goto source code">[src]</a></div><a href="#method.set_multicast_if_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_multicast_if_v4" class="fnname">set_multicast_if_v4</a>(&self, interface: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.multicast_loop_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1216-1221" title="goto source code">[src]</a></div><a href="#method.multicast_loop_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.multicast_loop_v4" class="fnname">multicast_loop_v4</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_multicast_loop_v4"><code>set_multicast_loop_v4</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_multicast_loop_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1227-1236" title="goto source code">[src]</a></div><a href="#method.set_multicast_loop_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_multicast_loop_v4" class="fnname">set_multicast_loop_v4</a>(&self, loop_v4: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.multicast_ttl_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1243-1248" title="goto source code">[src]</a></div><a href="#method.multicast_ttl_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.multicast_ttl_v4" class="fnname">multicast_ttl_v4</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><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="struct.Socket.html#method.set_multicast_ttl_v4"><code>set_multicast_ttl_v4</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_multicast_ttl_v4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1257-1266" title="goto source code">[src]</a></div><a href="#method.set_multicast_ttl_v4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_multicast_ttl_v4" class="fnname">set_multicast_ttl_v4</a>(&self, ttl: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.ttl" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1273-1277" title="goto source code">[src]</a></div><a href="#method.ttl" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.ttl" class="fnname">ttl</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><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="struct.Socket.html#method.set_ttl"><code>set_ttl</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_ttl" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1283-1285" title="goto source code">[src]</a></div><a href="#method.set_ttl" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_ttl" class="fnname">set_ttl</a>(&self, ttl: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_tos" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1300-1302" title="goto source code">[src]</a></div><a href="#method.set_tos" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_tos" class="fnname">set_tos</a>(&self, tos: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>IP_TOS</code> option for this socket.</p>
|
||
<p>This value sets the type-of-service field that is used in every packet
|
||
sent from this socket.</p>
|
||
<p>NOTE: <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>
|
||
documents that not all versions of windows support <code>IP_TOS</code>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.tos" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1318-1322" title="goto source code">[src]</a></div><a href="#method.tos" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.tos" class="fnname">tos</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>IP_TOS</code> option for this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_tos"><code>set_tos</code></a>.</p>
|
||
<p>NOTE: <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>
|
||
documents that not all versions of windows support <code>IP_TOS</code>.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-3" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1330-1514" title="goto source code">[src]</a></div><a href="#impl-3" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><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"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.join_multicast_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1338-1352" title="goto source code">[src]</a></div><a href="#method.join_multicast_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.join_multicast_v6" class="fnname">join_multicast_v6</a>(<br> &self, <br> multiaddr: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv6Addr.html" title="struct std::net::ip::Ipv6Addr">Ipv6Addr</a>, <br> interface: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.leave_multicast_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1361-1375" title="goto source code">[src]</a></div><a href="#method.leave_multicast_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.leave_multicast_v6" class="fnname">leave_multicast_v6</a>(<br> &self, <br> multiaddr: &<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/ip/struct.Ipv6Addr.html" title="struct std::net::ip::Ipv6Addr">Ipv6Addr</a>, <br> interface: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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="struct.Socket.html#method.join_multicast_v6"><code>join_multicast_v6</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.multicast_hops_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1382-1387" title="goto source code">[src]</a></div><a href="#method.multicast_hops_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.multicast_hops_v6" class="fnname">multicast_hops_v6</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><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="struct.Socket.html#method.set_multicast_hops_v6"><code>set_multicast_hops_v6</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_multicast_hops_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1394-1403" title="goto source code">[src]</a></div><a href="#method.set_multicast_hops_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_multicast_hops_v6" class="fnname">set_multicast_hops_v6</a>(&self, hops: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>IPV6_MULTICAST_HOPS</code> option for this socket</p>
|
||
<p>Indicates the number of “routers” 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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.multicast_if_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1410-1415" title="goto source code">[src]</a></div><a href="#method.multicast_if_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.multicast_if_v6" class="fnname">multicast_if_v6</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><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="struct.Socket.html#method.set_multicast_if_v6"><code>set_multicast_if_v6</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_multicast_if_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1422-1431" title="goto source code">[src]</a></div><a href="#method.set_multicast_if_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_multicast_if_v6" class="fnname">set_multicast_if_v6</a>(&self, interface: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.multicast_loop_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1438-1443" title="goto source code">[src]</a></div><a href="#method.multicast_loop_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.multicast_loop_v6" class="fnname">multicast_loop_v6</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_multicast_loop_v6"><code>set_multicast_loop_v6</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_multicast_loop_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1449-1458" title="goto source code">[src]</a></div><a href="#method.set_multicast_loop_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_multicast_loop_v6" class="fnname">set_multicast_loop_v6</a>(&self, loop_v6: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.unicast_hops_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1463-1468" title="goto source code">[src]</a></div><a href="#method.unicast_hops_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.unicast_hops_v6" class="fnname">unicast_hops_v6</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_unicast_hops_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1473-1482" title="goto source code">[src]</a></div><a href="#method.set_unicast_hops_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_unicast_hops_v6" class="fnname">set_unicast_hops_v6</a>(&self, hops: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.only_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1489-1494" title="goto source code">[src]</a></div><a href="#method.only_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.only_v6" class="fnname">only_v6</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_only_v6"><code>set_only_v6</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_only_v6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1504-1513" title="goto source code">[src]</a></div><a href="#method.set_only_v6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_only_v6" class="fnname">set_only_v6</a>(&self, only_v6: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-4" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1521-1700" title="goto source code">[src]</a></div><a href="#impl-4" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><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"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.keepalive_time" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1540-1542" title="goto source code">[src]</a></div><a href="#method.keepalive_time" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.keepalive_time" class="fnname">keepalive_time</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_KEEPIDLE</code> option on this socket.</p>
|
||
<p>This returns the value of <code>TCP_KEEPALIVE</code> on macOS and iOS and <code>TCP_KEEPIDLE</code> on all other
|
||
supported Unix operating systems.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.keepalive_interval" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1579-1584" title="goto source code">[src]</a></div><a href="#method.keepalive_interval" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.keepalive_interval" class="fnname">keepalive_interval</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_KEEPINTVL</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_tcp_keepalive"><code>set_tcp_keepalive</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.keepalive_retries" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1621-1626" title="goto source code">[src]</a></div><a href="#method.keepalive_retries" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.keepalive_retries" class="fnname">keepalive_retries</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_KEEPCNT</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_tcp_keepalive"><code>set_tcp_keepalive</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_tcp_keepalive" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1666-1669" title="goto source code">[src]</a></div><a href="#method.set_tcp_keepalive" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_tcp_keepalive" class="fnname">set_tcp_keepalive</a>(&self, params: &<a class="struct" href="struct.TcpKeepalive.html" title="struct socket2::TcpKeepalive">TcpKeepalive</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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="struct.TcpKeepalive.html" title="TcpKeepalive"><code>TcpKeepalive</code></a> struct. At a minimum, all systems
|
||
support configuring the <a href="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>
|
||
<h5 id="notes-7" class="section-header"><a href="#notes-7">Notes</a></h5>
|
||
<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>
|
||
<h5 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">std::time::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::new</span>(<span class="ident">Domain::IPV4</span>, <span class="ident">Type::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::new</span>()
|
||
.<span class="ident">with_time</span>(<span class="ident">Duration::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">&</span><span class="ident">keepalive</span>)<span class="question-mark">?</span>;</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.nodelay" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1676-1681" title="goto source code">[src]</a></div><a href="#method.nodelay" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.nodelay" class="fnname">nodelay</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><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="struct.Socket.html#method.set_nodelay"><code>set_nodelay</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_nodelay" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1690-1699" title="goto source code">[src]</a></div><a href="#method.set_nodelay" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_nodelay" class="fnname">set_nodelay</a>(&self, nodelay: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><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></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-5" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1029-1994" title="goto source code">[src]</a></div><a href="#impl-5" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="docblock"><p>Unix only API.</p>
|
||
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.accept4" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1066-1068" title="goto source code">[src]</a></div><a href="#method.accept4" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.accept4" class="fnname">accept4</a>(&self, flags: <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">(</a><a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>, <a class="struct" href="struct.SockAddr.html" title="struct socket2::SockAddr">SockAddr</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.tuple.html">)</a>></h4></div></summary><div class="docblock"><p>Accept a new incoming connection from this listener.</p>
|
||
<p>This function directly corresponds to the <code>accept4(2)</code> function.</p>
|
||
<p>This function will block the calling thread until a new connection is
|
||
established. When established, the corresponding <code>Socket</code> and the remote
|
||
peer’s address will be returned.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_cloexec" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1097-1099" title="goto source code">[src]</a></div><a href="#method.set_cloexec" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_cloexec" class="fnname">set_cloexec</a>(&self, close_on_exec: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Sets <code>CLOEXEC</code> on the socket.</p>
|
||
<h5 id="notes-8" class="section-header"><a href="#notes-8">Notes</a></h5>
|
||
<p>On supported platforms you can use <a href="struct.Type.html#method.cloexec" title="Type::cloexec"><code>Type::cloexec</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_nosigpipe" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1122-1124" title="goto source code">[src]</a></div><a href="#method.set_nosigpipe" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_nosigpipe" class="fnname">set_nosigpipe</a>(&self, nosigpipe: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Sets <code>SO_NOSIGPIPE</code> on the socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.mss" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1145-1150" title="goto source code">[src]</a></div><a href="#method.mss" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.mss" class="fnname">mss</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><div class="docblock"><p>Gets the value of the <code>TCP_MAXSEG</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_mss"><code>set_mss</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_mss" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1158-1167" title="goto source code">[src]</a></div><a href="#method.set_mss" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_mss" class="fnname">set_mss</a>(&self, mss: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Sets the value of the <code>TCP_MAXSEG</code> option on this socket.</p>
|
||
<p>The <code>TCP_MAXSEG</code> option denotes the TCP Maximum Segment Size and is only
|
||
available on TCP sockets.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_listener" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1192-1197" title="goto source code">[src]</a></div><a href="#method.is_listener" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.is_listener" class="fnname">is_listener</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Returns <code>true</code> if <code>listen(2)</code> was called on this socket by checking the
|
||
<code>SO_ACCEPTCONN</code> option on this socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.domain" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1221-1223" title="goto source code">[src]</a></div><a href="#method.domain" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.domain" class="fnname">domain</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="struct.Domain.html" title="struct socket2::Domain">Domain</a>></h4></div></summary><div class="docblock"><p>Returns the <a href="struct.Domain.html" title="Domain"><code>Domain</code></a> of this socket by checking the <code>SO_DOMAIN</code> option
|
||
on this socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.protocol" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1248-1256" title="goto source code">[src]</a></div><a href="#method.protocol" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.protocol" class="fnname">protocol</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.Protocol.html" title="struct socket2::Protocol">Protocol</a>>></h4></div></summary><div class="docblock"><p>Returns the <a href="struct.Protocol.html" title="Protocol"><code>Protocol</code></a> of this socket by checking the <code>SO_PROTOCOL</code>
|
||
option on this socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.mark" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1275-1280" title="goto source code">[src]</a></div><a href="#method.mark" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.mark" class="fnname">mark</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>></h4></div></summary><div class="docblock"><p>Gets the value for the <code>SO_MARK</code> option on this socket.</p>
|
||
<p>This value gets the socket mark field for each packet sent through
|
||
this socket.</p>
|
||
<p>On Linux this function requires the <code>CAP_NET_ADMIN</code> capability.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_mark" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1300-1309" title="goto source code">[src]</a></div><a href="#method.set_mark" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_mark" class="fnname">set_mark</a>(&self, mark: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u32.html">u32</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Sets the value for the <code>SO_MARK</code> option on this socket.</p>
|
||
<p>This value sets the socket mark field for each packet sent through
|
||
this socket. Changing the mark can be used for mark-based routing
|
||
without netfilter or for packet filtering.</p>
|
||
<p>On Linux this function requires the <code>CAP_NET_ADMIN</code> capability.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.cork" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1327-1332" title="goto source code">[src]</a></div><a href="#method.cork" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.cork" class="fnname">cork</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_CORK</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="Socket::set_cork"><code>set_cork</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_cork" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1351-1360" title="goto source code">[src]</a></div><a href="#method.set_cork" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_cork" class="fnname">set_cork</a>(&self, cork: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>TCP_CORK</code> option on this socket.</p>
|
||
<p>If set, don’t send out partial frames. All queued partial frames are
|
||
sent when the option is cleared again. There is a 200 millisecond ceiling on
|
||
the time for which output is corked by <code>TCP_CORK</code>. If this ceiling is reached,
|
||
then queued data is automatically transmitted.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.quickack" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1378-1383" title="goto source code">[src]</a></div><a href="#method.quickack" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.quickack" class="fnname">quickack</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_QUICKACK</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="Socket::set_quickack"><code>set_quickack</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_quickack" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1402-1411" title="goto source code">[src]</a></div><a href="#method.set_quickack" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_quickack" class="fnname">set_quickack</a>(&self, quickack: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>TCP_QUICKACK</code> option on this socket.</p>
|
||
<p>If set, acks are sent immediately, rather than delayed if needed in accordance to normal
|
||
TCP operation. This flag is not permanent, it only enables a switch to or from quickack mode.
|
||
Subsequent operation of the TCP protocol will once again enter/leave quickack mode depending on
|
||
internal protocol processing and factors such as delayed ack timeouts occurring and data transfer.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.thin_linear_timeouts" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1429-1438" title="goto source code">[src]</a></div><a href="#method.thin_linear_timeouts" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.thin_linear_timeouts" class="fnname">thin_linear_timeouts</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_THIN_LINEAR_TIMEOUTS</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="Socket::set_thin_linear_timeouts"><code>set_thin_linear_timeouts</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_thin_linear_timeouts" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1456-1465" title="goto source code">[src]</a></div><a href="#method.set_thin_linear_timeouts" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_thin_linear_timeouts" class="fnname">set_thin_linear_timeouts</a>(&self, timeouts: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>TCP_THIN_LINEAR_TIMEOUTS</code> option on this socket.</p>
|
||
<p>If set, the kernel will dynamically detect a thin-stream connection if there are less than four packets in flight.
|
||
With less than four packets in flight the normal TCP fast retransmission will not be effective.
|
||
The kernel will modify the retransmission to avoid the very high latencies that thin stream suffer because of exponential backoff.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.device" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1481-1502" title="goto source code">[src]</a></div><a href="#method.device" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.device" class="fnname">device</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>>>></h4></div></summary><div class="docblock"><p>Gets the value for the <code>SO_BINDTODEVICE</code> option on this socket.</p>
|
||
<p>This value gets the socket binded device’s interface name.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.bind_device" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1522-1536" title="goto source code">[src]</a></div><a href="#method.bind_device" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.bind_device" class="fnname">bind_device</a>(&self, interface: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Sets the value for the <code>SO_BINDTODEVICE</code> option on this socket.</p>
|
||
<p>If a socket is bound to an interface, only packets received from that
|
||
particular interface are processed by the socket. Note that this only
|
||
works for some socket types, particularly <code>AF_INET</code> sockets.</p>
|
||
<p>If <code>interface</code> is <code>None</code> or an empty string it removes the binding.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.cpu_affinity" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1591-1596" title="goto source code">[src]</a></div><a href="#method.cpu_affinity" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.cpu_affinity" class="fnname">cpu_affinity</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>SO_INCOMING_CPU</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_cpu_affinity"><code>set_cpu_affinity</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_cpu_affinity" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1603-1612" title="goto source code">[src]</a></div><a href="#method.set_cpu_affinity" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_cpu_affinity" class="fnname">set_cpu_affinity</a>(&self, cpu: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set value for the <code>SO_INCOMING_CPU</code> option on this socket.</p>
|
||
<p>Sets the CPU affinity of the socket.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.reuse_port" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1631-1636" title="goto source code">[src]</a></div><a href="#method.reuse_port" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.reuse_port" class="fnname">reuse_port</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>SO_REUSEPORT</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_reuse_port"><code>set_reuse_port</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_reuse_port" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1655-1664" title="goto source code">[src]</a></div><a href="#method.set_reuse_port" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_reuse_port" class="fnname">set_reuse_port</a>(&self, reuse: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set value for the <code>SO_REUSEPORT</code> option on this socket.</p>
|
||
<p>This indicates that further 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></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.freebind" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1682-1687" title="goto source code">[src]</a></div><a href="#method.freebind" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.freebind" class="fnname">freebind</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>IP_FREEBIND</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="struct.Socket.html#method.set_freebind"><code>set_freebind</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_freebind" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1707-1716" title="goto source code">[src]</a></div><a href="#method.set_freebind" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_freebind" class="fnname">set_freebind</a>(&self, freebind: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set value for the <code>IP_FREEBIND</code> option on this socket.</p>
|
||
<p>If enabled, this boolean option allows binding to an IP address that is
|
||
nonlocal or does not (yet) exist. This permits listening on a socket,
|
||
without requiring the underlying network interface or the specified
|
||
dynamic IP address to be up at the time that the application is trying
|
||
to bind to it.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.freebind_ipv6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1730-1735" title="goto source code">[src]</a></div><a href="#method.freebind_ipv6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.freebind_ipv6" class="fnname">freebind_ipv6</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>></h4></div></summary><div class="docblock"><p>Get the value of the <code>IPV6_FREEBIND</code> option on this socket.</p>
|
||
<p>This is an IPv6 counterpart of <code>IP_FREEBIND</code> socket option on
|
||
Android/Linux. For more information about this option, see
|
||
<a href="struct.Socket.html#method.set_freebind"><code>set_freebind</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_freebind_ipv6" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1772-1781" title="goto source code">[src]</a></div><a href="#method.set_freebind_ipv6" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_freebind_ipv6" class="fnname">set_freebind_ipv6</a>(&self, freebind: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set value for the <code>IPV6_FREEBIND</code> option on this socket.</p>
|
||
<p>This is an IPv6 counterpart of <code>IP_FREEBIND</code> socket option on
|
||
Android/Linux. For more information about this option, see
|
||
<a href="struct.Socket.html#method.set_freebind"><code>set_freebind</code></a>.</p>
|
||
<h5 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h5>
|
||
<p>On Linux:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">socket2</span>::{<span class="ident">Domain</span>, <span class="ident">Socket</span>, <span class="ident">Type</span>};
|
||
<span class="kw">use</span> <span class="ident">std::io</span>::{<span class="self">self</span>, <span class="ident">Error</span>, <span class="ident">ErrorKind</span>};
|
||
|
||
<span class="kw">fn</span> <span class="ident">enable_freebind</span>(<span class="ident">socket</span>: <span class="kw-2">&</span><span class="ident">Socket</span>) -> <span class="ident">io::Result</span><span class="op"><</span>()<span class="op">></span> {
|
||
<span class="kw">match</span> <span class="ident">socket</span>.<span class="ident">domain</span>()<span class="question-mark">?</span> {
|
||
<span class="ident">Domain::IPV4</span> => <span class="ident">socket</span>.<span class="ident">set_freebind</span>(<span class="bool-val">true</span>)<span class="question-mark">?</span>,
|
||
<span class="ident">Domain::IPV6</span> => <span class="ident">socket</span>.<span class="ident">set_freebind_ipv6</span>(<span class="bool-val">true</span>)<span class="question-mark">?</span>,
|
||
<span class="kw">_</span> => <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">Error::new</span>(<span class="ident">ErrorKind::Other</span>, <span class="string">"unsupported domain"</span>)),
|
||
};
|
||
<span class="prelude-val">Ok</span>(())
|
||
}
|
||
</code></pre></div>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.sendfile" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1822-1832" title="goto source code">[src]</a></div><a href="#method.sendfile" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.sendfile" class="fnname">sendfile</a><F>(<br> &self, <br> file: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>F, <br> offset: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <br> length: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/num/nonzero/struct.NonZeroUsize.html" title="struct core::num::nonzero::NonZeroUsize">NonZeroUsize</a>><br>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>> <span class="where fmt-newline">where<br> F: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.AsRawFd.html" title="trait std::os::fd::raw::AsRawFd">AsRawFd</a>, </span></h4></div></summary><div class="docblock"><p>Copies data between a <code>file</code> and this socket using the <code>sendfile(2)</code>
|
||
system call. Because this copying is done within the kernel,
|
||
<code>sendfile()</code> is more efficient than the combination of <code>read(2)</code> and
|
||
<code>write(2)</code>, which would require transferring data to and from user
|
||
space.</p>
|
||
<p>Different OSs support different kinds of <code>file</code>s, see the OS
|
||
documentation for what kind of files are supported. Generally <em>regular</em>
|
||
files are supported by all OSs.</p>
|
||
<p>The <code>offset</code> is the absolute offset into the <code>file</code> to use as starting
|
||
point.</p>
|
||
<p>Depending on the OS this function <em>may</em> change the offset of <code>file</code>. For
|
||
the best results reset the offset of the file before using it again.</p>
|
||
<p>The <code>length</code> determines how many bytes to send, where a length of <code>None</code>
|
||
means it will try to send all bytes.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.set_tcp_user_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1921-1933" title="goto source code">[src]</a></div><a href="#method.set_tcp_user_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.set_tcp_user_timeout" class="fnname">set_tcp_user_timeout</a>(&self, timeout: <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Set the value of the <code>TCP_USER_TIMEOUT</code> option on this socket.</p>
|
||
<p>If set, this specifies the maximum amount of time that transmitted data may remain
|
||
unacknowledged or buffered data may remain untransmitted before TCP will forcibly close the
|
||
corresponding connection.</p>
|
||
<p>Setting <code>timeout</code> to <code>None</code> or a zero duration causes the system default timeouts to
|
||
be used. If <code>timeout</code> in milliseconds is larger than <code>c_uint::MAX</code>, the timeout is clamped
|
||
to <code>c_uint::MAX</code>. For example, when <code>c_uint</code> is a 32-bit value, this limits the timeout to
|
||
approximately 49.71 days.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.tcp_user_timeout" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1951-1962" title="goto source code">[src]</a></div><a href="#method.tcp_user_timeout" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.tcp_user_timeout" class="fnname">tcp_user_timeout</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/1.59.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>>></h4></div></summary><div class="docblock"><p>Get the value of the <code>TCP_USER_TIMEOUT</code> option on this socket.</p>
|
||
<p>For more information about this option, see <a href="Socket::set_tcp_user_timeout"><code>set_tcp_user_timeout</code></a>.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.attach_filter" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1971-1985" title="goto source code">[src]</a></div><a href="#method.attach_filter" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.attach_filter" class="fnname">attach_filter</a>(&self, filters: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="../libc/unix/linux_like/linux/struct.sock_filter.html" title="struct libc::unix::linux_like::linux::sock_filter">sock_filter</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Attach Berkeley Packet Filter(BPF) on this socket.</p>
|
||
<p>BPF allows a user-space program to attach a filter onto any socket
|
||
and allow or disallow certain types of data to come through the socket.</p>
|
||
<p>For more information about this option, see <a href="https://www.kernel.org/doc/html/v5.12/networking/filter.html">filter</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.detach_filter" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1991-1993" title="goto source code">[src]</a></div><a href="#method.detach_filter" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.detach_filter" class="fnname">detach_filter</a>(&self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class="docblock"><p>Detach Berkeley Packet Filter(BPF) from this socket.</p>
|
||
<p>For more information about this option, see [<code>attach_filter</code>]</p>
|
||
</div></details></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-AsRawFd" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1997-2001" title="goto source code">[src]</a></div><a href="#impl-AsRawFd" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.AsRawFd.html" title="trait std::os::fd::raw::AsRawFd">AsRawFd</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.as_raw_fd" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#1998-2000" title="goto source code">[src]</a></div><a href="#method.as_raw_fd" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.AsRawFd.html#tymethod.as_raw_fd" class="fnname">as_raw_fd</a>(&self) -> <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a></h4></div></summary><div class='docblock'><p>Extracts the raw file descriptor. <a href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.AsRawFd.html#tymethod.as_raw_fd">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1766-1774" title="goto source code">[src]</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1767-1773" title="goto source code">[src]</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.59.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CSocket%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1779" title="goto source code">[src]</a></div><a href="#impl-From%3CSocket%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpStream.html" title="struct std::net::tcp::TcpStream">TcpStream</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-3" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1779" title="goto source code">[src]</a></div><a href="#method.from-3" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpStream.html" title="struct std::net::tcp::TcpStream">TcpStream</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CSocket%3E-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1780" title="goto source code">[src]</a></div><a href="#impl-From%3CSocket%3E-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-4" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1780" title="goto source code">[src]</a></div><a href="#method.from-4" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CSocket%3E-2" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1781" title="goto source code">[src]</a></div><a href="#impl-From%3CSocket%3E-2" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/udp/struct.UdpSocket.html" title="struct std::net::udp::UdpSocket">UdpSocket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-5" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1781" title="goto source code">[src]</a></div><a href="#method.from-5" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/udp/struct.UdpSocket.html" title="struct std::net::udp::UdpSocket">UdpSocket</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CSocket%3E-3" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2024" title="goto source code">[src]</a></div><a href="#impl-From%3CSocket%3E-3" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/stream/struct.UnixStream.html" title="struct std::os::unix::net::stream::UnixStream">UnixStream</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-9" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2024" title="goto source code">[src]</a></div><a href="#method.from-9" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/stream/struct.UnixStream.html" title="struct std::os::unix::net::stream::UnixStream">UnixStream</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CSocket%3E-4" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2026" title="goto source code">[src]</a></div><a href="#impl-From%3CSocket%3E-4" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/listener/struct.UnixListener.html" title="struct std::os::unix::net::listener::UnixListener">UnixListener</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-10" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2026" title="goto source code">[src]</a></div><a href="#method.from-10" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/listener/struct.UnixListener.html" title="struct std::os::unix::net::listener::UnixListener">UnixListener</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CSocket%3E-5" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2028" title="goto source code">[src]</a></div><a href="#impl-From%3CSocket%3E-5" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>> for <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/datagram/struct.UnixDatagram.html" title="struct std::os::unix::net::datagram::UnixDatagram">UnixDatagram</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-11" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2028" title="goto source code">[src]</a></div><a href="#method.from-11" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/datagram/struct.UnixDatagram.html" title="struct std::os::unix::net::datagram::UnixDatagram">UnixDatagram</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CTcpListener%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1777" title="goto source code">[src]</a></div><a href="#impl-From%3CTcpListener%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1777" title="goto source code">[src]</a></div><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpListener.html" title="struct std::net::tcp::TcpListener">TcpListener</a>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CTcpStream%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1776" title="goto source code">[src]</a></div><a href="#impl-From%3CTcpStream%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpStream.html" title="struct std::net::tcp::TcpStream">TcpStream</a>> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1776" title="goto source code">[src]</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/tcp/struct.TcpStream.html" title="struct std::net::tcp::TcpStream">TcpStream</a>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CUdpSocket%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1778" title="goto source code">[src]</a></div><a href="#impl-From%3CUdpSocket%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/udp/struct.UdpSocket.html" title="struct std::net::udp::UdpSocket">UdpSocket</a>> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1778" title="goto source code">[src]</a></div><a href="#method.from-2" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/net/udp/struct.UdpSocket.html" title="struct std::net::udp::UdpSocket">UdpSocket</a>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CUnixDatagram%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2022" title="goto source code">[src]</a></div><a href="#impl-From%3CUnixDatagram%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/datagram/struct.UnixDatagram.html" title="struct std::os::unix::net::datagram::UnixDatagram">UnixDatagram</a>> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-8" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2022" title="goto source code">[src]</a></div><a href="#method.from-8" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/datagram/struct.UnixDatagram.html" title="struct std::os::unix::net::datagram::UnixDatagram">UnixDatagram</a>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CUnixListener%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2020" title="goto source code">[src]</a></div><a href="#impl-From%3CUnixListener%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/listener/struct.UnixListener.html" title="struct std::os::unix::net::listener::UnixListener">UnixListener</a>> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-7" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2020" title="goto source code">[src]</a></div><a href="#method.from-7" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/listener/struct.UnixListener.html" title="struct std::os::unix::net::listener::UnixListener">UnixListener</a>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CUnixStream%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2018" title="goto source code">[src]</a></div><a href="#impl-From%3CUnixStream%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/stream/struct.UnixStream.html" title="struct std::os::unix::net::stream::UnixStream">UnixStream</a>> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-6" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2018" title="goto source code">[src]</a></div><a href="#method.from-6" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(socket: <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/os/unix/net/stream/struct.UnixStream.html" title="struct std::os::unix::net::stream::UnixStream">UnixStream</a>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-FromRawFd" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2011-2015" title="goto source code">[src]</a></div><a href="#impl-FromRawFd" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.FromRawFd.html" title="trait std::os::fd::raw::FromRawFd">FromRawFd</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from_raw_fd" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2012-2014" title="goto source code">[src]</a></div><a href="#method.from_raw_fd" class="anchor"></a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/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>) -> <a class="struct" href="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"><div class="notable">Notable traits for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></div><code class="content"><span class="where fmt-newline">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="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/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span><span class="where fmt-newline">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></span></code></span></div></span></span></h4></div></summary><div class='docblock'><p>Constructs a new instance of <code>Self</code> from the given raw file
|
||
descriptor. <a href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.FromRawFd.html#tymethod.from_raw_fd">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-IntoRawFd" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2004-2008" title="goto source code">[src]</a></div><a href="#impl-IntoRawFd" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.IntoRawFd.html" title="trait std::os::fd::raw::IntoRawFd">IntoRawFd</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into_raw_fd" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/sys/unix.rs.html#2005-2007" title="goto source code">[src]</a></div><a href="#method.into_raw_fd" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.IntoRawFd.html#tymethod.into_raw_fd" class="fnname">into_raw_fd</a>(self) -> <a class="type" href="../libc/unix/type.c_int.html" title="type libc::unix::c_int">c_int</a></h4></div></summary><div class='docblock'><p>Consumes this object, returning the raw underlying file descriptor. <a href="https://doc.rust-lang.org/1.59.0/std/os/fd/raw/trait.IntoRawFd.html#tymethod.into_raw_fd">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Read" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1702-1719" title="goto source code">[src]</a></div><a href="#impl-Read" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1703-1708" title="goto source code">[src]</a></div><a href="#method.read" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#tymethod.read" class="fnname">read</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Pull some bytes from this source into the specified buffer, returning
|
||
how many bytes were read. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#tymethod.read">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_vectored" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1711-1718" title="goto source code">[src]</a></div><a href="#method.read_vectored" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_vectored" class="fnname">read_vectored</a>(&mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Like <code>read</code>, except that it reads into a slice of buffers. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_read_vectored" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#657" title="goto source code">[src]</a></div><a href="#method.is_read_vectored" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.is_read_vectored" class="fnname">is_read_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock'><p>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
|
||
implementation. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.is_read_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_to_end" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#708" title="goto source code">[src]</a></div><a href="#method.read_to_end" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_end" class="fnname">read_to_end</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_end">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_to_string" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#751" title="goto source code">[src]</a></div><a href="#method.read_to_string" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_string" class="fnname">read_to_string</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_string">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_exact" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.6.0">1.6.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#806" title="goto source code">[src]</a></div><a href="#method.read_exact" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_exact" class="fnname">read_exact</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_exact">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_buf" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#817" title="goto source code">[src]</a></div><a href="#method.read_buf" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf" class="fnname">read_buf</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/readbuf/struct.ReadBuf.html" title="struct std::io::readbuf::ReadBuf">ReadBuf</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>read_buf</code>)</div></div><div class='docblock'><p>Pull some bytes from this source into the specified buffer. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_buf_exact" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#826" title="goto source code">[src]</a></div><a href="#method.read_buf_exact" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf_exact" class="fnname">read_buf_exact</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/readbuf/struct.ReadBuf.html" title="struct std::io::readbuf::ReadBuf">ReadBuf</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>read_buf</code>)</div></div><div class='docblock'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf_exact">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.by_ref-2" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#878-880" title="goto source code">[src]</a></div><a href="#method.by_ref-2" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.by_ref" class="fnname">by_ref</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>Self</h4></div></summary><div class='docblock'><p>Creates a “by reference” adaptor for this instance of <code>Read</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.by_ref">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.bytes" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#916-918" title="goto source code">[src]</a></div><a href="#method.bytes" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.bytes" class="fnname">bytes</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><Self></h4></div></summary><div class='docblock'><p>Transforms this <code>Read</code> instance to an <a href="https://doc.rust-lang.org/1.59.0/core/iter/traits/iterator/trait.Iterator.html" title="Iterator"><code>Iterator</code></a> over its bytes. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.bytes">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.chain" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#954-956" title="goto source code">[src]</a></div><a href="#method.chain" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.chain" class="fnname">chain</a><R>(self, next: R) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><Self, R> <span class="where fmt-newline">where<br> R: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a>, </span></h4></div></summary><div class='docblock'><p>Creates an adapter which will chain this stream with another. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.chain">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.take" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#993-995" title="goto source code">[src]</a></div><a href="#method.take" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.take" class="fnname">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u64.html">u64</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.Take.html" title="struct std::io::Take">Take</a><Self></h4></div></summary><div class='docblock'><p>Creates an adapter which will read at most <code>limit</code> bytes from it. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.take">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Read-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1721-1734" title="goto source code">[src]</a></div><a href="#impl-Read-1" class="anchor"></a><h3 class="code-header in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1722-1726" title="goto source code">[src]</a></div><a href="#method.read-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#tymethod.read" class="fnname">read</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Pull some bytes from this source into the specified buffer, returning
|
||
how many bytes were read. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#tymethod.read">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_vectored-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1729-1733" title="goto source code">[src]</a></div><a href="#method.read_vectored-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_vectored" class="fnname">read_vectored</a>(&mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSliceMut.html" title="struct std::io::IoSliceMut">IoSliceMut</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Like <code>read</code>, except that it reads into a slice of buffers. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_read_vectored-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#657" title="goto source code">[src]</a></div><a href="#method.is_read_vectored-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.is_read_vectored" class="fnname">is_read_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock'><p>Determines if this <code>Read</code>er has an efficient <code>read_vectored</code>
|
||
implementation. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.is_read_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_to_end-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#708" title="goto source code">[src]</a></div><a href="#method.read_to_end-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_end" class="fnname">read_to_end</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Read all bytes until EOF in this source, placing them into <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_end">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_to_string-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#751" title="goto source code">[src]</a></div><a href="#method.read_to_string-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_string" class="fnname">read_to_string</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Read all bytes until EOF in this source, appending them to <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_to_string">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_exact-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.6.0">1.6.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#806" title="goto source code">[src]</a></div><a href="#method.read_exact-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_exact" class="fnname">read_exact</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_exact">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_buf-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#817" title="goto source code">[src]</a></div><a href="#method.read_buf-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf" class="fnname">read_buf</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/readbuf/struct.ReadBuf.html" title="struct std::io::readbuf::ReadBuf">ReadBuf</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>read_buf</code>)</div></div><div class='docblock'><p>Pull some bytes from this source into the specified buffer. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.read_buf_exact-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#826" title="goto source code">[src]</a></div><a href="#method.read_buf_exact-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf_exact" class="fnname">read_buf_exact</a>(&mut self, buf: &mut <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/readbuf/struct.ReadBuf.html" title="struct std::io::readbuf::ReadBuf">ReadBuf</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>read_buf</code>)</div></div><div class='docblock'><p>Read the exact number of bytes required to fill <code>buf</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.read_buf_exact">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.by_ref-3" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#878-880" title="goto source code">[src]</a></div><a href="#method.by_ref-3" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.by_ref" class="fnname">by_ref</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>Self</h4></div></summary><div class='docblock'><p>Creates a “by reference” adaptor for this instance of <code>Read</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.by_ref">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.bytes-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#916-918" title="goto source code">[src]</a></div><a href="#method.bytes-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.bytes" class="fnname">bytes</a>(self) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.Bytes.html" title="struct std::io::Bytes">Bytes</a><Self></h4></div></summary><div class='docblock'><p>Transforms this <code>Read</code> instance to an <a href="https://doc.rust-lang.org/1.59.0/core/iter/traits/iterator/trait.Iterator.html" title="Iterator"><code>Iterator</code></a> over its bytes. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.bytes">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.chain-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#954-956" title="goto source code">[src]</a></div><a href="#method.chain-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.chain" class="fnname">chain</a><R>(self, next: R) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.Chain.html" title="struct std::io::Chain">Chain</a><Self, R> <span class="where fmt-newline">where<br> R: <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html" title="trait std::io::Read">Read</a>, </span></h4></div></summary><div class='docblock'><p>Creates an adapter which will chain this stream with another. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.chain">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.take-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#993-995" title="goto source code">[src]</a></div><a href="#method.take-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.take" class="fnname">take</a>(self, limit: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u64.html">u64</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.Take.html" title="struct std::io::Take">Take</a><Self></h4></div></summary><div class='docblock'><p>Creates an adapter which will read at most <code>limit</code> bytes from it. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Read.html#method.take">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Write" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1736-1749" title="goto source code">[src]</a></div><a href="#impl-Write" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1737-1739" title="goto source code">[src]</a></div><a href="#method.write" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.write" class="fnname">write</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Write a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.write">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_vectored" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1742-1744" title="goto source code">[src]</a></div><a href="#method.write_vectored" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_vectored" class="fnname">write_vectored</a>(&mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Like <a href="https://doc.rust-lang.org/1.59.0/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/1.59.0/std/io/trait.Write.html#method.write_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.flush" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1746-1748" title="goto source code">[src]</a></div><a href="#method.flush" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.flush" class="fnname">flush</a>(&mut self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class='docblock'><p>Flush this output stream, ensuring that all intermediately buffered
|
||
contents reach their destination. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.flush">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_write_vectored" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1456" title="goto source code">[src]</a></div><a href="#method.is_write_vectored" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.is_write_vectored" class="fnname">is_write_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock'><p>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_vectored"><code>write_vectored</code></a>
|
||
implementation. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.is_write_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_all" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1518" title="goto source code">[src]</a></div><a href="#method.write_all" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all" class="fnname">write_all</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_all_vectored" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1583" title="goto source code">[src]</a></div><a href="#method.write_all_vectored" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all_vectored" class="fnname">write_all_vectored</a>(&mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="item-info"><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'><p>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_fmt" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1639" title="goto source code">[src]</a></div><a href="#method.write_fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_fmt" class="fnname">write_fmt</a>(&mut self, fmt: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Writes a formatted string into this writer, returning any error
|
||
encountered. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_fmt">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.by_ref" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1695-1697" title="goto source code">[src]</a></div><a href="#method.by_ref" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.by_ref" class="fnname">by_ref</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>Self</h4></div></summary><div class='docblock'><p>Creates a “by reference” adapter for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.by_ref">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Write-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1751-1764" title="goto source code">[src]</a></div><a href="#impl-Write-1" class="anchor"></a><h3 class="code-header in-band">impl<'a> <a class="trait" href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a> for &'a <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1752-1754" title="goto source code">[src]</a></div><a href="#method.write-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.write" class="fnname">write</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Write a buffer into this writer, returning how many bytes were written. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.write">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_vectored-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1757-1759" title="goto source code">[src]</a></div><a href="#method.write_vectored-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_vectored" class="fnname">write_vectored</a>(&mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.usize.html">usize</a>></h4></div></summary><div class='docblock'><p>Like <a href="https://doc.rust-lang.org/1.59.0/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/1.59.0/std/io/trait.Write.html#method.write_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.flush-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/socket2/socket.rs.html#1761-1763" title="goto source code">[src]</a></div><a href="#method.flush-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.flush" class="fnname">flush</a>(&mut self) -> <a class="type" href="https://doc.rust-lang.org/1.59.0/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>></h4></div></summary><div class='docblock'><p>Flush this output stream, ensuring that all intermediately buffered
|
||
contents reach their destination. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#tymethod.flush">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.is_write_vectored-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1456" title="goto source code">[src]</a></div><a href="#method.is_write_vectored-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.is_write_vectored" class="fnname">is_write_vectored</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.bool.html">bool</a></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>can_vector</code>)</div></div><div class='docblock'><p>Determines if this <code>Write</code>r has an efficient <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_vectored"><code>write_vectored</code></a>
|
||
implementation. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.is_write_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_all-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1518" title="goto source code">[src]</a></div><a href="#method.write_all-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all" class="fnname">write_all</a>(&mut self, buf: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Attempts to write an entire buffer into this writer. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_all_vectored-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1583" title="goto source code">[src]</a></div><a href="#method.write_all_vectored-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all_vectored" class="fnname">write_all_vectored</a>(&mut self, bufs: <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">&mut [</a><a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/struct.IoSlice.html" title="struct std::io::IoSlice">IoSlice</a><'_><a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.slice.html">]</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class="item-info"><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'><p>Attempts to write multiple buffers into this writer. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_all_vectored">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.write_fmt-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1639" title="goto source code">[src]</a></div><a href="#method.write_fmt-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_fmt" class="fnname">write_fmt</a>(&mut self, fmt: <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/fmt/struct.Arguments.html" title="struct core::fmt::Arguments">Arguments</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.59.0/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>></h4></div></summary><div class='docblock'><p>Writes a formatted string into this writer, returning any error
|
||
encountered. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.write_fmt">Read more</a></p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.by_ref-1" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/std/io/mod.rs.html#1695-1697" title="goto source code">[src]</a></div><a href="#method.by_ref-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.by_ref" class="fnname">by_ref</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>Self</h4></div></summary><div class='docblock'><p>Creates a “by reference” adapter for this instance of <code>Write</code>. <a href="https://doc.rust-lang.org/1.59.0/std/io/trait.Write.html#method.by_ref">Read more</a></p>
|
||
</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Socket.html" title="struct socket2::Socket">Socket</a></h3></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"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/any.rs.html#132-136" title="goto source code">[src]</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/any.rs.html#133" title="goto source code">[src]</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.59.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.59.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#209-214" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#211" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#218-222" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/1.59.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/borrow.rs.html#219" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.59.0/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.59.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#550-554" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-12" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#551" title="goto source code">[src]</a></div><a href="#method.from-12" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#538-545" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#542" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#588-597" title="goto source code">[src]</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#594" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#574-583" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.59.0/src/core/convert/mod.rs.html#580" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.59.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.59.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||
</div></details></div></details></div></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="socket2" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.59.0 (9d1b2106e 2022-02-23)" ></div>
|
||
</body></html> |