Debian Codegraph @

src/ext.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![allow(bad_style, dead_code)]
12
13 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
14 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/;
15 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::{TcpStreamrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/tcp/TcpStream#, TcpListenerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/tcp/TcpListener#, UdpSocketrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/udp/UdpSocket#, Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#};
16 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::ToSocketAddrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#;
17
18 use {TcpBuilderrust-analyzer cargo net2 0.2.39 tcp/TcpBuilder#, UdpBuilderrust-analyzer cargo net2 0.2.39 udp/UdpBuilder#, FromInnerrust-analyzer cargo net2 0.2.39 FromInner#};
19 use sysrust-analyzer cargo net2 0.2.39 sys/;
20 use sysrust-analyzer cargo net2 0.2.39 sys/::crust-analyzer cargo net2 0.2.39 sys/c/;
21 use socketrust-analyzer cargo net2 0.2.39 socket/;
22
23 cfg_ifrust-analyzer cargo cfg-if 1.0.4 crate/! {
24 if #[cfg(any(target_os = "dragonfly",
25 target_os = "freebsd",
26 target_os = "haiku",
27 target_os = "ios",
28 target_os = "macos",
29 target_os = "netbsd",
30 target_os = "openbsd",
31 target_os = "solaris",
32 target_os = "illumos",
33 target_env = "uclibc"))] {
34 use libc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
35 use libc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
36 } else {
37 // ...
38 }
39 }
40
41 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#;
42
43 #[cfg(any(unix, target_os = "wasi"))] use libcrust-analyzer cargo libc 0.2.189 crate/::*;
44 #[cfg(any(unix))] use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::preluderust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/prelude/::*;
45 #[cfg(target_os = "wasi")] use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::wasi::prelude::*;
46 #[cfg(unix)] pub type Socketrust-analyzer cargo net2 0.2.39 ext/Socket# = c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#;
47 #[cfg(target_os = "wasi")] pub type Socket = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::wasi::io::RawFd;
48 #[cfg(windows)] pub type Socket = SOCKET;
49 #[cfg(windows)] use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::windows::prelude::*;
50 #[cfg(any(windows, target_os = "wasi"))] use sysrust-analyzer cargo net2 0.2.39 sys/::crust-analyzer cargo net2 0.2.39 sys/c/::*;
51
52 #[cfg(windows)] const SIO_KEEPALIVE_VALS: DWORD = 0x98000004;
53 #[cfg(windows)]
54 #[repr(C)]
55 struct tcp_keepalive {
56 onoff: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
57 keepalivetime: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
58 keepaliveinterval: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
59 }
60
61 #[cfg(any(unix, target_os = "wasi"))] fn vrust-analyzer cargo net2 0.2.39 ext/v().(opt: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { opt }
62 #[cfg(windows)] fn v(opt: IPPROTO) -> c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { opt as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# }
63
64 #[cfg(target_os = "wasi")]
65 pub fn set_opt<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>(_sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, _opt: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, _val: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#,
66 _payload: T) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
67 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
68 }
69
70 #[cfg(not(target_os = "wasi"))]
71 pub fn set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>(sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, opt: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, val: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#,
72 payload: T) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
73 unsafe {
74 let payload = &payload as *const T as *const c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#;
75 tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(::cvtrust-analyzer cargo net2 0.2.39 cvt().(setsockoptrust-analyzer cargo libc 0.2.189 setsockopt().(sock, opt, val, payload as *const _,
76 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() as socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#)));
77 }
78 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
79 }
80
81 #[cfg(target_os = "wasi")]
82 pub fn get_opt<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>(_sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, _opt: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, _val: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<T> {
83 unimplementedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unimplemented!!()
84 }
85 #[cfg(not(target_os = "wasi"))]
86 pub fn get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>(sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, opt: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, val: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<T> {
87 unsafe {
88 let mut slot: T = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().();
89 let mut len = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() as socklen_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/socklen_t#;
90 tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(::cvtrust-analyzer cargo net2 0.2.39 cvt().(getsockoptrust-analyzer cargo libc 0.2.189 getsockopt().(sock, opt, val,
91 &mut slot as *mut _ as *mut _,
92 &mut len)));
93 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(len as usize, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>());
94 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(slot)
95 }
96 }
97
98 /// Extension methods for the standard [`TcpStream` type][link] in `std::net`.
99 ///
100 /// [link]: https://doc.rust-lang.org/std/net/struct.TcpStream.html
101 pub trait TcpStreamExtrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt# {
102 /// Sets the value of the `TCP_NODELAY` option on this socket.
103 ///
104 /// If set, this option disables the Nagle algorithm. This means that
105 /// segments are always sent as soon as possible, even if there is only a
106 /// small amount of data. When not set, data is buffered until there is a
107 /// sufficient amount to send out, thereby avoiding the frequent sending of
108 /// small packets.
109 fn set_nodelayrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_nodelay().(&self, nodelay: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
110
111 /// Gets the value of the `TCP_NODELAY` option on this socket.
112 ///
113 /// For more information about this option, see [`set_nodelay`][link].
114 ///
115 /// [link]: #tymethod.set_nodelay
116 fn nodelayrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#nodelay().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
117
118 /// Sets the value of the `SO_RCVBUF` option on this socket.
119 ///
120 /// Changes the size of the operating system's receive buffer associated with the socket.
121 fn set_recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_recv_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
122
123 /// Gets the value of the `SO_RCVBUF` option on this socket.
124 ///
125 /// For more information about this option, see [`set_recv_buffer_size`][link].
126 ///
127 /// [link]: #tymethod.set_recv_buffer_size
128 fn recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#recv_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize>;
129
130 /// Sets the value of the `SO_SNDBUF` option on this socket.
131 ///
132 /// Changes the size of the operating system's send buffer associated with the socket.
133 fn set_send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_send_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
134
135 /// Gets the value of the `SO_SNDBUF` option on this socket.
136 ///
137 /// For more information about this option, see [`set_send_buffer`][link].
138 ///
139 /// [link]: #tymethod.set_send_buffer
140 fn send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#send_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize>;
141
142 /// Sets whether keepalive messages are enabled to be sent on this socket.
143 ///
144 /// On Unix, this option will set the `SO_KEEPALIVE` as well as the
145 /// `TCP_KEEPALIVE` or `TCP_KEEPIDLE` option (depending on your platform).
146 /// On Windows, this will set the `SIO_KEEPALIVE_VALS` option.
147 ///
148 /// If `None` is specified then keepalive messages are disabled, otherwise
149 /// the number of milliseconds specified will be the time to remain idle
150 /// before sending a TCP keepalive probe.
151 ///
152 /// Some platforms specify this value in seconds, so sub-second millisecond
153 /// specifications may be omitted.
154 fn set_keepalive_msrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_keepalive_ms().(&self, keepalive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
155
156 /// Returns whether keepalive messages are enabled on this socket, and if so
157 /// the amount of milliseconds between them.
158 ///
159 /// For more information about this option, see [`set_keepalive_ms`][link].
160 ///
161 /// [link]: #tymethod.set_keepalive_ms
162 fn keepalive_msrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#keepalive_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>>;
163
164 /// Sets whether keepalive messages are enabled to be sent on this socket.
165 ///
166 /// On Unix, this option will set the `SO_KEEPALIVE` as well as the
167 /// `TCP_KEEPALIVE` or `TCP_KEEPIDLE` option (depending on your platform).
168 /// On Windows, this will set the `SIO_KEEPALIVE_VALS` option.
169 ///
170 /// If `None` is specified then keepalive messages are disabled, otherwise
171 /// the duration specified will be the time to remain idle before sending a
172 /// TCP keepalive probe.
173 ///
174 /// Some platforms specify this value in seconds, so sub-second
175 /// specifications may be omitted.
176 fn set_keepaliverust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_keepalive().(&self, keepalive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
177
178 /// Returns whether keepalive messages are enabled on this socket, and if so
179 /// the duration of time between them.
180 ///
181 /// For more information about this option, see [`set_keepalive`][link].
182 ///
183 /// [link]: #tymethod.set_keepalive
184 fn keepaliverust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#keepalive().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
185
186 /// Sets the `SO_RCVTIMEO` option for this socket.
187 ///
188 /// This option specifies the timeout, in milliseconds, of how long calls to
189 /// this socket's `read` function will wait before returning a timeout. A
190 /// value of `None` means that no read timeout should be specified and
191 /// otherwise `Some` indicates the number of milliseconds for the timeout.
192 fn set_read_timeout_msrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_read_timeout_ms().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
193
194 /// Sets the `SO_RCVTIMEO` option for this socket.
195 ///
196 /// This option specifies the timeout of how long calls to this socket's
197 /// `read` function will wait before returning a timeout. A value of `None`
198 /// means that no read timeout should be specified and otherwise `Some`
199 /// indicates the number of duration of the timeout.
200 fn set_read_timeoutrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_read_timeout().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
201
202 /// Gets the value of the `SO_RCVTIMEO` option for this socket.
203 ///
204 /// For more information about this option, see [`set_read_timeout_ms`][link].
205 ///
206 /// [link]: #tymethod.set_read_timeout_ms
207 fn read_timeout_msrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#read_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>>;
208
209 /// Gets the value of the `SO_RCVTIMEO` option for this socket.
210 ///
211 /// For more information about this option, see [`set_read_timeout`][link].
212 ///
213 /// [link]: #tymethod.set_read_timeout
214 fn read_timeoutrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#read_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
215
216 /// Sets the `SO_SNDTIMEO` option for this socket.
217 ///
218 /// This option specifies the timeout, in milliseconds, of how long calls to
219 /// this socket's `write` function will wait before returning a timeout. A
220 /// value of `None` means that no read timeout should be specified and
221 /// otherwise `Some` indicates the number of milliseconds for the timeout.
222 fn set_write_timeout_msrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_write_timeout_ms().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
223
224 /// Sets the `SO_SNDTIMEO` option for this socket.
225 ///
226 /// This option specifies the timeout of how long calls to this socket's
227 /// `write` function will wait before returning a timeout. A value of `None`
228 /// means that no read timeout should be specified and otherwise `Some`
229 /// indicates the duration of the timeout.
230 fn set_write_timeoutrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_write_timeout().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
231
232 /// Gets the value of the `SO_SNDTIMEO` option for this socket.
233 ///
234 /// For more information about this option, see [`set_write_timeout_ms`][link].
235 ///
236 /// [link]: #tymethod.set_write_timeout_ms
237 fn write_timeout_msrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#write_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>>;
238
239 /// Gets the value of the `SO_SNDTIMEO` option for this socket.
240 ///
241 /// For more information about this option, see [`set_write_timeout`][link].
242 ///
243 /// [link]: #tymethod.set_write_timeout
244 fn write_timeoutrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#write_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
245
246 /// Sets the value for the `IP_TTL` option on this socket.
247 ///
248 /// This value sets the time-to-live field that is used in every packet sent
249 /// from this socket.
250 fn set_ttlrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
251
252 /// Gets the value of the `IP_TTL` option for this socket.
253 ///
254 /// For more information about this option, see [`set_ttl`][link].
255 ///
256 /// [link]: #tymethod.set_ttl
257 fn ttlrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#ttl().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
258
259 /// Sets the value for the `IPV6_V6ONLY` option on this socket.
260 ///
261 /// If this is set to `true` then the socket is restricted to sending and
262 /// receiving IPv6 packets only. In this case two IPv4 and IPv6 applications
263 /// can bind the same port at the same time.
264 ///
265 /// If this is set to `false` then the socket can be used to send and
266 /// receive packets from an IPv4-mapped IPv6 address.
267 fn set_only_v6rust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
268
269 /// Gets the value of the `IPV6_V6ONLY` option for this socket.
270 ///
271 /// For more information about this option, see [`set_only_v6`][link].
272 ///
273 /// [link]: #tymethod.set_only_v6
274 fn only_v6rust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#only_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
275
276 /// Executes a `connect` operation on this socket, establishing a connection
277 /// to the host specified by `addr`.
278 ///
279 /// Note that this normally does not need to be called on a `TcpStream`,
280 /// it's typically automatically done as part of a normal
281 /// `TcpStream::connect` function call or `TcpBuilder::connect` method call.
282 ///
283 /// This should only be necessary if an unconnected socket was extracted
284 /// from a `TcpBuilder` and then needs to be connected.
285 fn connectrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#connect().<T: ToSocketAddrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#>(&self, addr: T) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
286
287 /// Get the value of the `SO_ERROR` option on this socket.
288 ///
289 /// This will retrieve the stored error in the underlying socket, clearing
290 /// the field in the process. This can be useful for checking errors between
291 /// calls.
292 fn take_errorrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>>;
293
294 /// Moves this TCP stream into or out of nonblocking mode.
295 ///
296 /// On Unix this corresponds to calling fcntl, and on Windows this
297 /// corresponds to calling ioctlsocket.
298 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_nonblocking().(&self, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
299
300 /// Sets the linger duration of this socket by setting the SO_LINGER option
301 fn set_lingerrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#set_linger().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
302
303 /// reads the linger duration for this socket by getting the SO_LINGER option
304 fn lingerrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt#linger().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
305 }
306
307 /// Extension methods for the standard [`TcpListener` type][link] in `std::net`.
308 ///
309 /// [link]: https://doc.rust-lang.org/std/net/struct.TcpListener.html
310 pub trait TcpListenerExtrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt# {
311 /// Sets the value for the `IP_TTL` option on this socket.
312 ///
313 /// This is the same as [`TcpStreamExt::set_ttl`][other].
314 ///
315 /// [other]: trait.TcpStreamExt.html#tymethod.set_ttl
316 fn set_ttlrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#set_ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
317
318 /// Gets the value of the `IP_TTL` option for this socket.
319 ///
320 /// For more information about this option, see
321 /// [`TcpStreamExt::set_ttl`][link].
322 ///
323 /// [link]: trait.TcpStreamExt.html#tymethod.set_ttl
324 fn ttlrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#ttl().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
325
326 /// Sets the value for the `IPV6_V6ONLY` option on this socket.
327 ///
328 /// For more information about this option, see
329 /// [`TcpStreamExt::set_only_v6`][link].
330 ///
331 /// [link]: trait.TcpStreamExt.html#tymethod.set_only_v6
332 fn set_only_v6rust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#set_only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
333
334 /// Gets the value of the `IPV6_V6ONLY` option for this socket.
335 ///
336 /// For more information about this option, see
337 /// [`TcpStreamExt::set_only_v6`][link].
338 ///
339 /// [link]: trait.TcpStreamExt.html#tymethod.set_only_v6
340 fn only_v6rust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#only_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
341
342 /// Get the value of the `SO_ERROR` option on this socket.
343 ///
344 /// This will retrieve the stored error in the underlying socket, clearing
345 /// the field in the process. This can be useful for checking errors between
346 /// calls.
347 fn take_errorrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>>;
348
349 /// Moves this TCP listener into or out of nonblocking mode.
350 ///
351 /// For more information about this option, see
352 /// [`TcpStreamExt::set_nonblocking`][link].
353 ///
354 /// [link]: trait.TcpStreamExt.html#tymethod.set_nonblocking
355 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#set_nonblocking().(&self, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
356
357 /// Sets the linger duration of this socket by setting the SO_LINGER option
358 fn set_lingerrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#set_linger().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
359
360 /// reads the linger duration for this socket by getting the SO_LINGER option
361 fn lingerrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt#linger().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
362 }
363
364 /// Extension methods for the standard [`UdpSocket` type][link] in `std::net`.
365 ///
366 /// [link]: https://doc.rust-lang.org/std/net/struct.UdpSocket.html
367 pub trait UdpSocketExtrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt# {
368 /// Sets the value of the `SO_RCVBUF` option on this socket.
369 ///
370 /// Changes the size of the operating system's receive buffer associated with the socket.
371 fn set_recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_recv_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
372
373 /// Gets the value of the `SO_RCVBUF` option on this socket.
374 ///
375 /// For more information about this option, see [`set_recv_buffer_size`][link].
376 ///
377 /// [link]: #tymethod.set_recv_buffer_size
378 fn recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#recv_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize>;
379
380 /// Sets the value of the `SO_SNDBUF` option on this socket.
381 ///
382 /// Changes the size of the operating system's send buffer associated with the socket.
383 fn set_send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_send_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
384
385 /// Gets the value of the `SO_SNDBUF` option on this socket.
386 ///
387 /// For more information about this option, see [`set_send_buffer`][link].
388 ///
389 /// [link]: #tymethod.set_send_buffer
390 fn send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#send_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize>;
391
392 /// Sets the value of the `SO_BROADCAST` option for this socket.
393 ///
394 /// When enabled, this socket is allowed to send packets to a broadcast
395 /// address.
396 fn set_broadcastrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_broadcast().(&self, broadcast: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
397
398 /// Gets the value of the `SO_BROADCAST` option for this socket.
399 ///
400 /// For more information about this option, see
401 /// [`set_broadcast`][link].
402 ///
403 /// [link]: #tymethod.set_broadcast
404 fn broadcastrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#broadcast().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
405
406 /// Sets the value of the `IP_MULTICAST_LOOP` option for this socket.
407 ///
408 /// If enabled, multicast packets will be looped back to the local socket.
409 /// Note that this may not have any affect on IPv6 sockets.
410 fn set_multicast_loop_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_multicast_loop_v4().(&self, multicast_loop_v4: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
411
412 /// Gets the value of the `IP_MULTICAST_LOOP` option for this socket.
413 ///
414 /// For more information about this option, see
415 /// [`set_multicast_loop_v4`][link].
416 ///
417 /// [link]: #tymethod.set_multicast_loop_v4
418 fn multicast_loop_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#multicast_loop_v4().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
419
420 /// Sets the value of the `IP_MULTICAST_TTL` option for this socket.
421 ///
422 /// Indicates the time-to-live value of outgoing multicast packets for
423 /// this socket. The default value is 1 which means that multicast packets
424 /// don't leave the local network unless explicitly requested.
425 ///
426 /// Note that this may not have any affect on IPv6 sockets.
427 fn set_multicast_ttl_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_multicast_ttl_v4().(&self, multicast_ttl_v4: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
428
429 /// Gets the value of the `IP_MULTICAST_TTL` option for this socket.
430 ///
431 /// For more information about this option, see
432 /// [`set_multicast_ttl_v4`][link].
433 ///
434 /// [link]: #tymethod.set_multicast_ttl_v4
435 fn multicast_ttl_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#multicast_ttl_v4().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
436
437 /// Sets the value of the `IPV6_MULTICAST_HOPS` option for this socket
438 fn set_multicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_multicast_hops_v6().(&self, hops: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
439
440 /// Gets the value of the `IPV6_MULTICAST_HOPS` option for this socket
441 fn multicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#multicast_hops_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
442
443 /// Sets the value of the `IPV6_MULTICAST_LOOP` option for this socket.
444 ///
445 /// Controls whether this socket sees the multicast packets it sends itself.
446 /// Note that this may not have any affect on IPv4 sockets.
447 fn set_multicast_loop_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_multicast_loop_v6().(&self, multicast_loop_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
448
449 /// Gets the value of the `IPV6_MULTICAST_LOOP` option for this socket.
450 ///
451 /// For more information about this option, see
452 /// [`set_multicast_loop_v6`][link].
453 ///
454 /// [link]: #tymethod.set_multicast_loop_v6
455 fn multicast_loop_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#multicast_loop_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
456
457 /// Sets the value of the `IP_MULTICAST_IF` option for this socket.
458 ///
459 /// Specifies the interface to use for routing multicast packets.
460 fn set_multicast_if_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_multicast_if_v4().(&self, interface: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
461
462 /// Gets the value of the `IP_MULTICAST_IF` option for this socket.
463 ///
464 /// Returns the interface to use for routing multicast packets.
465 fn multicast_if_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#multicast_if_v4().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#>;
466
467
468 /// Sets the value of the `IPV6_MULTICAST_IF` option for this socket.
469 ///
470 /// Specifies the interface to use for routing multicast packets.
471 fn set_multicast_if_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_multicast_if_v6().(&self, interface: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
472
473 /// Gets the value of the `IPV6_MULTICAST_IF` option for this socket.
474 ///
475 /// Returns the interface to use for routing multicast packets.
476 fn multicast_if_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#multicast_if_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
477
478 /// Sets the value for the `IP_TTL` option on this socket.
479 ///
480 /// This is the same as [`TcpStreamExt::set_ttl`][other].
481 ///
482 /// [other]: trait.TcpStreamExt.html#tymethod.set_ttl
483 fn set_ttlrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
484
485 /// Gets the value of the `IP_TTL` option for this socket.
486 ///
487 /// For more information about this option, see
488 /// [`TcpStreamExt::set_ttl`][link].
489 ///
490 /// [link]: trait.TcpStreamExt.html#tymethod.set_ttl
491 fn ttlrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#ttl().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
492
493 /// Sets the value for the `IPV6_UNICAST_HOPS` option on this socket.
494 ///
495 /// Specifies the hop limit for ipv6 unicast packets
496 fn set_unicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_unicast_hops_v6().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
497
498 /// Gets the value of the `IPV6_UNICAST_HOPS` option for this socket.
499 ///
500 /// Specifies the hop limit for ipv6 unicast packets
501 fn unicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#unicast_hops_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32>;
502
503 /// Sets the value for the `IPV6_V6ONLY` option on this socket.
504 ///
505 /// For more information about this option, see
506 /// [`TcpStreamExt::set_only_v6`][link].
507 ///
508 /// [link]: trait.TcpStreamExt.html#tymethod.set_only_v6
509 fn set_only_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
510
511 /// Gets the value of the `IPV6_V6ONLY` option for this socket.
512 ///
513 /// For more information about this option, see
514 /// [`TcpStreamExt::set_only_v6`][link].
515 ///
516 /// [link]: trait.TcpStreamExt.html#tymethod.set_only_v6
517 fn only_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#only_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool>;
518
519 /// Executes an operation of the `IP_ADD_MEMBERSHIP` type.
520 ///
521 /// This function specifies a new multicast group for this socket to join.
522 /// The address must be a valid multicast address, and `interface` is the
523 /// address of the local interface with which the system should join the
524 /// multicast group. If it's equal to `INADDR_ANY` then an appropriate
525 /// interface is chosen by the system.
526 fn join_multicast_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#join_multicast_v4().(&self, multiaddr: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, interface: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#)
527 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
528
529 /// Executes an operation of the `IPV6_ADD_MEMBERSHIP` type.
530 ///
531 /// This function specifies a new multicast group for this socket to join.
532 /// The address must be a valid multicast address, and `interface` is the
533 /// index of the interface to join/leave (or 0 to indicate any interface).
534 fn join_multicast_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#join_multicast_v6().(&self, multiaddr: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, interface: u32)
535 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
536
537 /// Executes an operation of the `IP_DROP_MEMBERSHIP` type.
538 ///
539 /// For more information about this option, see
540 /// [`join_multicast_v4`][link].
541 ///
542 /// [link]: #tymethod.join_multicast_v4
543 fn leave_multicast_v4rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#leave_multicast_v4().(&self, multiaddr: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, interface: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#)
544 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
545
546 /// Executes an operation of the `IPV6_DROP_MEMBERSHIP` type.
547 ///
548 /// For more information about this option, see
549 /// [`join_multicast_v6`][link].
550 ///
551 /// [link]: #tymethod.join_multicast_v6
552 fn leave_multicast_v6rust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#leave_multicast_v6().(&self, multiaddr: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, interface: u32)
553 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
554
555 /// Sets the `SO_RCVTIMEO` option for this socket.
556 ///
557 /// This option specifies the timeout, in milliseconds, of how long calls to
558 /// this socket's `read` function will wait before returning a timeout. A
559 /// value of `None` means that no read timeout should be specified and
560 /// otherwise `Some` indicates the number of milliseconds for the timeout.
561 fn set_read_timeout_msrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_read_timeout_ms().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
562
563 /// Sets the `SO_RCVTIMEO` option for this socket.
564 ///
565 /// This option specifies the timeout of how long calls to this socket's
566 /// `read` function will wait before returning a timeout. A value of `None`
567 /// means that no read timeout should be specified and otherwise `Some`
568 /// indicates the number of duration of the timeout.
569 fn set_read_timeoutrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_read_timeout().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
570
571 /// Gets the value of the `SO_RCVTIMEO` option for this socket.
572 ///
573 /// For more information about this option, see [`set_read_timeout_ms`][link].
574 ///
575 /// [link]: #tymethod.set_read_timeout_ms
576 fn read_timeout_msrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#read_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>>;
577
578 /// Gets the value of the `SO_RCVTIMEO` option for this socket.
579 ///
580 /// For more information about this option, see [`set_read_timeout`][link].
581 ///
582 /// [link]: #tymethod.set_read_timeout
583 fn read_timeoutrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#read_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
584
585 /// Sets the `SO_SNDTIMEO` option for this socket.
586 ///
587 /// This option specifies the timeout, in milliseconds, of how long calls to
588 /// this socket's `write` function will wait before returning a timeout. A
589 /// value of `None` means that no read timeout should be specified and
590 /// otherwise `Some` indicates the number of milliseconds for the timeout.
591 fn set_write_timeout_msrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_write_timeout_ms().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
592
593 /// Sets the `SO_SNDTIMEO` option for this socket.
594 ///
595 /// This option specifies the timeout of how long calls to this socket's
596 /// `write` function will wait before returning a timeout. A value of `None`
597 /// means that no read timeout should be specified and otherwise `Some`
598 /// indicates the duration of the timeout.
599 fn set_write_timeoutrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_write_timeout().(&self, val: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
600
601 /// Gets the value of the `SO_SNDTIMEO` option for this socket.
602 ///
603 /// For more information about this option, see [`set_write_timeout_ms`][link].
604 ///
605 /// [link]: #tymethod.set_write_timeout_ms
606 fn write_timeout_msrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#write_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>>;
607
608 /// Gets the value of the `SO_SNDTIMEO` option for this socket.
609 ///
610 /// For more information about this option, see [`set_write_timeout`][link].
611 ///
612 /// [link]: #tymethod.set_write_timeout
613 fn write_timeoutrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#write_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>>;
614
615 /// Get the value of the `SO_ERROR` option on this socket.
616 ///
617 /// This will retrieve the stored error in the underlying socket, clearing
618 /// the field in the process. This can be useful for checking errors between
619 /// calls.
620 fn take_errorrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>>;
621
622 /// Connects this UDP socket to a remote address, allowing the `send` and
623 /// `recv` syscalls to be used to send data and also applies filters to only
624 /// receive data from the specified address.
625 fn connectrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#connect().<A: ToSocketAddrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#>(&self, addr: A) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
626
627 /// Sends data on the socket to the remote address to which it is connected.
628 ///
629 /// The `connect` method will connect this socket to a remote address. This
630 /// method will fail if the socket is not connected.
631 fn sendrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#send().(&self, buf: &[u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize>;
632
633 /// Receives data on the socket from the remote address to which it is
634 /// connected.
635 ///
636 /// The `connect` method will connect this socket to a remote address. This
637 /// method will fail if the socket is not connected.
638 fn recvrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#recv().(&self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize>;
639
640 /// Moves this UDP socket into or out of nonblocking mode.
641 ///
642 /// For more information about this option, see
643 /// [`TcpStreamExt::set_nonblocking`][link].
644 ///
645 /// [link]: trait.TcpStreamExt.html#tymethod.set_nonblocking
646 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt#set_nonblocking().(&self, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>;
647 }
648
649 #[doc(hidden)]
650 pub trait AsSockrust-analyzer cargo net2 0.2.39 ext/AsSock# {
651 fn as_sockrust-analyzer cargo net2 0.2.39 ext/AsSock#as_sock().(&self) -> Socketrust-analyzer cargo net2 0.2.39 ext/Socket#;
652 }
653
654 #[cfg(any(unix, target_os = "wasi"))]
655 impl<T: AsRawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/AsRawFd#> AsSockrust-analyzer cargo net2 0.2.39 ext/AsSock# for T {
656 fn as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(&self) -> Socketrust-analyzer cargo net2 0.2.39 ext/Socket# { self.as_raw_fdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/AsRawFd#as_raw_fd().() }
657 }
658 #[cfg(windows)]
659 impl<T: AsRawSocket> AsSockrust-analyzer cargo net2 0.2.39 ext/AsSock# for T {
660 fn as_sock(&self) -> Socketrust-analyzer cargo net2 0.2.39 ext/Socket# { selfrust-analyzer cargo net2 0.2.39 ext/.as_raw_socket() as Socketrust-analyzer cargo net2 0.2.39 ext/Socket# }
661 }
662
663 cfg_ifrust-analyzer cargo cfg-if 1.0.4 crate/! {
664 if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "nto"))] {
665 use libc::TCP_KEEPALIVE as KEEPALIVE_OPTION;
666 } else if #[cfg(any(target_os = "haiku", target_os = "netbsd", target_os = "openbsd"))] {
667 use libc::SO_KEEPALIVE as KEEPALIVE_OPTION;
668 } else if #[cfg(unix)] {
669 use libcrust-analyzer cargo libc 0.2.189 crate/::TCP_KEEPIDLErust-analyzer cargo libc 0.2.189 unix/linux_like/TCP_KEEPIDLE. as KEEPALIVE_OPTIONrust-analyzer cargo libc 0.2.189 unix/linux_like/TCP_KEEPIDLE.;
670 } else {
671 // ...
672 }
673 }
674
675 impl TcpStreamExtrust-analyzer cargo net2 0.2.39 ext/TcpStreamExt# for TcpStreamrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/tcp/TcpStream# {
676
677 fn set_recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_recv_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
678 // TODO: casting usize to a c_int should be a checked cast
679 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVBUF., size as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
680 }
681
682 fn recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]recv_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
683 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVBUF.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2usizerust-analyzer cargo net2 0.2.39 ext/int2usize().)
684 }
685
686 fn set_send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_send_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
687 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDBUF., size as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
688 }
689
690 fn send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]send_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
691 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDBUF.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2usizerust-analyzer cargo net2 0.2.39 ext/int2usize().)
692 }
693
694 fn set_nodelayrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_nodelay().(&self, nodelay: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
695 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_TCPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_TCP.), TCP_NODELAYrust-analyzer cargo libc 0.2.189 unix/linux_like/TCP_NODELAY.,
696 nodelay as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
697 }
698 fn nodelayrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]nodelay().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
699 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_TCPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_TCP.), TCP_NODELAYrust-analyzer cargo libc 0.2.189 unix/linux_like/TCP_NODELAY.)
700 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
701 }
702
703 fn set_keepaliverust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_keepalive().(&self, keepalive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
704 self.set_keepalive_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_keepalive_ms().(keepalive.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(dur2msrust-analyzer cargo net2 0.2.39 ext/dur2ms().))
705 }
706
707 fn keepaliverust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]keepalive().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
708 self.keepalive_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]keepalive_ms().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|o| o.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ms2durrust-analyzer cargo net2 0.2.39 ext/ms2dur().))
709 }
710
711 #[cfg(unix)]
712 fn set_keepalive_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_keepalive_ms().(&self, keepalive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
713 tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_KEEPALIVErust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_KEEPALIVE.,
714 keepalive.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#));
715 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dur) = keepalive {
716 tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_TCPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_TCP.), KEEPALIVE_OPTIONrust-analyzer cargo libc 0.2.189 unix/linux_like/TCP_KEEPIDLE.,
717 (dur /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). 1000) as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#));
718 }
719 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
720 }
721
722 #[cfg(unix)]
723 fn keepalive_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]keepalive_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
724 let keepalive = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET.,
725 SO_KEEPALIVErust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_KEEPALIVE.));
726 if keepalive rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {
727 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
728 }
729 let secs = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_TCPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_TCP.),
730 KEEPALIVE_OPTIONrust-analyzer cargo libc 0.2.189 unix/linux_like/TCP_KEEPIDLE.));
731 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((secs as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().1000))
732 }
733
734 #[cfg(target_os = "wasi")]
735 fn set_keepalive_ms(&self, _keepalive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
736 unimplementedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unimplemented!!()
737 }
738
739 #[cfg(target_os = "wasi")]
740 fn keepalive_ms(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
741 unimplementedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unimplemented!!()
742 }
743
744 #[cfg(windows)]
745 fn set_keepalive_ms(&self, keepalive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
746 let ms = keepalive.unwrap_or(INFINITE);
747 let ka = tcp_keepalive {
748 onoff: keepalive.is_some() as c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
749 keepalivetime: ms as c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
750 keepaliveinterval: ms as c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
751 };
752 unsafe {
753 ::cvt_win(WSAIoctl(selfrust-analyzer cargo net2 0.2.39 ext/.as_sock(),
754 SIO_KEEPALIVE_VALS,
755 &ka as *const _ as *mut _,
756 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&ka) as DWORD,
757 0 as *mut _,
758 0,
759 0 as *mut _,
760 0 as *mut _,
761 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)).map(|_| ())
762 }
763 }
764
765 #[cfg(windows)]
766 fn keepalive_ms(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
767 let mut ka = tcp_keepalive {
768 onoff: 0,
769 keepalivetime: 0,
770 keepaliveinterval: 0,
771 };
772 unsafe {
773 tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(::cvt_win(WSAIoctl(self.as_sock(),
774 SIO_KEEPALIVE_VALS,
775 0 as *mut _,
776 0,
777 &mut ka as *mut _ as *mut _,
778 mem::size_of_val(&ka) as DWORD,
779 0 as *mut _,
780 0 as *mut _,
781 None)));
782 }
783 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#({
784 if ka.onoff == 0 {
785 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
786 } else {
787 timeout2msrust-analyzer cargo net2 0.2.39 ext/timeout2ms().(ka.keepaliveinterval as DWORD)
788 }
789 })
790 }
791
792 fn set_read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_read_timeout_ms().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
793 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVTIMEO.,
794 ms2timeoutrust-analyzer cargo net2 0.2.39 ext/ms2timeout().(dur))
795 }
796
797 fn read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]read_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
798 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVTIMEO.)
799 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(timeout2msrust-analyzer cargo net2 0.2.39 ext/timeout2ms().)
800 }
801
802 fn set_write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_write_timeout_ms().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
803 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDTIMEO.,
804 ms2timeoutrust-analyzer cargo net2 0.2.39 ext/ms2timeout().(dur))
805 }
806
807 fn write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]write_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
808 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDTIMEO.)
809 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(timeout2msrust-analyzer cargo net2 0.2.39 ext/timeout2ms().)
810 }
811
812 fn set_read_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_read_timeout().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
813 self.set_read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_read_timeout_ms().(dur.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(dur2msrust-analyzer cargo net2 0.2.39 ext/dur2ms().))
814 }
815
816 fn read_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]read_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
817 self.read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]read_timeout_ms().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|o| o.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ms2durrust-analyzer cargo net2 0.2.39 ext/ms2dur().))
818 }
819
820 fn set_write_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_write_timeout().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
821 self.set_write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_write_timeout_ms().(dur.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(dur2msrust-analyzer cargo net2 0.2.39 ext/dur2ms().))
822 }
823
824 fn write_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]write_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
825 self.write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]write_timeout_ms().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|o| o.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ms2durrust-analyzer cargo net2 0.2.39 ext/ms2dur().))
826 }
827
828 fn set_ttlrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
829 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL., ttl as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
830 }
831
832 fn ttlrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]ttl().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
833 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL.)
834 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
835 }
836
837 fn set_only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
838 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY., only_v6 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
839 }
840
841 fn only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]only_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
842 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
843 }
844
845 fn connectrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]connect().<T: ToSocketAddrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#>(&self, addr: T) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
846 do_connectrust-analyzer cargo net2 0.2.39 ext/do_connect().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), addr)
847 }
848
849 fn take_errorrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>> {
850 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_ERRORrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_ERROR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2errrust-analyzer cargo net2 0.2.39 ext/int2err().)
851 }
852
853 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_nonblocking().(&self, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
854 set_nonblockingrust-analyzer cargo net2 0.2.39 ext/set_nonblocking().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), nonblocking)
855 }
856
857 fn set_lingerrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]set_linger().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
858 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_LINGERrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_LINGER., dur2lingerrust-analyzer cargo net2 0.2.39 ext/dur2linger().(dur))
859 }
860
861 fn lingerrust-analyzer cargo net2 0.2.39 ext/impl#[TcpStream][TcpStreamExt]linger().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
862 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_LINGERrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_LINGER.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(linger2durrust-analyzer cargo net2 0.2.39 ext/linger2dur().)
863 }
864 }
865
866 #[cfg(any(unix, target_os = "wasi"))]
867 fn ms2timeoutrust-analyzer cargo net2 0.2.39 ext/ms2timeout().(dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> timevalrust-analyzer cargo libc 0.2.189 unix/timeval# {
868 // TODO: be more rigorous
869 match dur {
870 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) => timevalrust-analyzer cargo libc 0.2.189 unix/timeval# {
871 tv_secrust-analyzer cargo libc 0.2.189 unix/timeval#tv_sec.: (d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().1000) as time_trust-analyzer cargo libc 0.2.189 unix/linux_like/linux/gnu/b64/time_t#,
872 tv_usecrust-analyzer cargo libc 0.2.189 unix/timeval#tv_usec.: (d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().1000) as _,
873 },
874 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => timevalrust-analyzer cargo libc 0.2.189 unix/timeval# { tv_secrust-analyzer cargo libc 0.2.189 unix/timeval#tv_sec.: 0, tv_usecrust-analyzer cargo libc 0.2.189 unix/timeval#tv_usec.: 0 },
875 }
876 }
877
878 #[cfg(any(unix, target_os = "wasi"))]
879 fn timeout2msrust-analyzer cargo net2 0.2.39 ext/timeout2ms().(dur: timevalrust-analyzer cargo libc 0.2.189 unix/timeval#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32> {
880 if dur.tv_secrust-analyzer cargo libc 0.2.189 unix/timeval#tv_sec. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialEq<Self>`]eq().0 && dur.tv_usecrust-analyzer cargo libc 0.2.189 unix/timeval#tv_usec. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i64][`PartialEq<Self>`]eq().0 {
881 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
882 } else {
883 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dur.tv_secrust-analyzer cargo libc 0.2.189 unix/timeval#tv_sec. as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().1000 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().dur.tv_usecrust-analyzer cargo libc 0.2.189 unix/timeval#tv_usec. as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().1000)
884 }
885 }
886
887 #[cfg(windows)]
888 fn ms2timeout(dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> DWORD {
889 dur.unwrap_or(0)
890 }
891
892 #[cfg(windows)]
893 fn timeout2ms(dur: DWORD) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32> {
894 if dur == 0 {
895 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
896 } else {
897 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dur)
898 }
899 }
900
901 fn linger2durrust-analyzer cargo net2 0.2.39 ext/linger2dur().(linger_opt: lingerrust-analyzer cargo libc 0.2.189 unix/linger#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#> {
•902 if linger_opt.l_onoffrust-analyzer cargo libc 0.2.189 unix/linger#l_onoff. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {
903 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
904 }
905 else {
906 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_secs().(linger_opt.l_lingerrust-analyzer cargo libc 0.2.189 unix/linger#l_linger. as u64))
907 }
908 }
909
910 #[cfg(windows)]
911 fn dur2linger(dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> lingerrust-analyzer cargo libc 0.2.189 unix/linger# {
912 match dur {
913 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) => {
914 lingerrust-analyzer cargo libc 0.2.189 unix/linger# {
915 l_onoff: 1,
916 l_linger: d.as_secs() as u16,
917 }
918 },
919 None => lingerrust-analyzer cargo libc 0.2.189 unix/linger# { l_onoff: 0, l_linger: 0 },
920 }
921 }
922
923 #[cfg(any(unix, target_os = "wasi"))]
924 fn dur2lingerrust-analyzer cargo net2 0.2.39 ext/dur2linger().(dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> lingerrust-analyzer cargo libc 0.2.189 unix/linger# {
925 match dur {
926 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(d) => {
927 lingerrust-analyzer cargo libc 0.2.189 unix/linger# {
928 l_onoffrust-analyzer cargo libc 0.2.189 unix/linger#l_onoff.: 1,
929 l_lingerrust-analyzer cargo libc 0.2.189 unix/linger#l_linger.: d.as_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_secs().() as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#,
930 }
931 },
932 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => lingerrust-analyzer cargo libc 0.2.189 unix/linger# { l_onoffrust-analyzer cargo libc 0.2.189 unix/linger#l_onoff.: 0, l_lingerrust-analyzer cargo libc 0.2.189 unix/linger#l_linger.: 0 },
933 }
934 }
935
936 fn ms2durrust-analyzer cargo net2 0.2.39 ext/ms2dur().(ms: u32) -> Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration# {
937 Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]new().((ms as u64) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`Div<Self>`]div().1000, (ms as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().1000 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().1_000_000)
938 }
939
940 fn dur2msrust-analyzer cargo net2 0.2.39 ext/dur2ms().(dur: Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#) -> u32 {
941 (dur.as_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_secs().() as u32 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Mul<Self>`]mul().1000) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Add<Self>`]add().(dur.subsec_nanosrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]subsec_nanos().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Div<Self>`]div().1_000_000)
942 }
943
944 pub fn int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().(n: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> bool {
945 if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {false} else {true}
946 }
947
948 pub fn int2usizerust-analyzer cargo net2 0.2.39 ext/int2usize().(n: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> usize {
949 // TODO: casting c_int to a usize should be a checked cast
950 n as usize
951 }
952
953 pub fn int2errrust-analyzer cargo net2 0.2.39 ext/int2err().(n: c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> {
954 if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {
955 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
956 } else {
957 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::from_raw_os_errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]from_raw_os_error().(n as i32))
958 }
959 }
960
961 impl UdpSocketExtrust-analyzer cargo net2 0.2.39 ext/UdpSocketExt# for UdpSocketrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/udp/UdpSocket# {
962
963 fn set_recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_recv_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
964 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVBUF., size as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
965 }
966
967 fn recv_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]recv_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
968 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVBUF.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2usizerust-analyzer cargo net2 0.2.39 ext/int2usize().)
969 }
970
971 fn set_send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_send_buffer_size().(&self, size: usize) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
972 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDBUF., size as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
973 }
974
975 fn send_buffer_sizerust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]send_buffer_size().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
976 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDBUFrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDBUF.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2usizerust-analyzer cargo net2 0.2.39 ext/int2usize().)
977 }
978
979 fn set_broadcastrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_broadcast().(&self, broadcast: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
980 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_BROADCASTrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_BROADCAST.,
981 broadcast as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
982 }
983 fn broadcastrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]broadcast().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
984 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_BROADCASTrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_BROADCAST.)
985 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
986 }
987 fn set_multicast_loop_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_multicast_loop_v4().(&self, multicast_loop_v4: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
988 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_MULTICAST_LOOPrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_MULTICAST_LOOP.,
989 multicast_loop_v4 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
990 }
991 fn multicast_loop_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]multicast_loop_v4().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
992 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_MULTICAST_LOOPrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_MULTICAST_LOOP.)
993 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
994 }
995
996 fn set_multicast_ttl_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_multicast_ttl_v4().(&self, multicast_ttl_v4: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
997 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_MULTICAST_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_MULTICAST_TTL.,
998 multicast_ttl_v4 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
999 }
1000
1001 fn multicast_ttl_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]multicast_ttl_v4().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
1002 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_MULTICAST_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_MULTICAST_TTL.)
1003 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
1004 }
1005
1006 fn set_multicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_multicast_hops_v6().(&self, _hops: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1007 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_MULTICAST_HOPSrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_MULTICAST_HOPS.,
1008 _hops as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1009 }
1010
1011 fn multicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]multicast_hops_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
1012 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_MULTICAST_HOPSrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_MULTICAST_HOPS.)
1013 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
1014 }
1015
1016 fn set_multicast_loop_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_multicast_loop_v6().(&self, multicast_loop_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1017 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_MULTICAST_LOOPrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_MULTICAST_LOOP.,
1018 multicast_loop_v6 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1019 }
1020 fn multicast_loop_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]multicast_loop_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
1021 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_MULTICAST_LOOPrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_MULTICAST_LOOP.)
1022 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
1023 }
1024
1025 fn set_multicast_if_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_multicast_if_v4().(&self, _interface: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1026 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_MULTICAST_IFrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_MULTICAST_IF., ip2in_addrrust-analyzer cargo net2 0.2.39 ext/ip2in_addr().(_interface))
1027 }
1028
1029 fn multicast_if_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]multicast_if_v4().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#> {
1030 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_MULTICAST_IFrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_MULTICAST_IF.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(in_addr2iprust-analyzer cargo net2 0.2.39 ext/in_addr2ip().)
1031 }
1032
1033 fn set_multicast_if_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_multicast_if_v6().(&self, _interface: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1034 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_MULTICAST_IFrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_MULTICAST_IF., to_ipv6mr_interfacerust-analyzer cargo net2 0.2.39 ext/to_ipv6mr_interface().(_interface))
1035 }
1036
1037 fn multicast_if_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]multicast_if_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
1038 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_MULTICAST_IFrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_MULTICAST_IF.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
1039 }
1040
1041 fn set_ttlrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1042 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL., ttl as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1043 }
1044
1045 fn ttlrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]ttl().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
1046 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL.)
1047 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
1048 }
1049
1050 fn set_unicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_unicast_hops_v6().(&self, _ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1051 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_UNICAST_HOPSrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_UNICAST_HOPS., _ttl as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1052 }
1053
1054 fn unicast_hops_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]unicast_hops_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
1055 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IPV6_UNICAST_HOPSrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_UNICAST_HOPS.)
1056 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
1057 }
1058
1059 fn set_only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1060 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY., only_v6 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1061 }
1062
1063 fn only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]only_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
1064 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
1065 }
1066
1067 fn join_multicast_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]join_multicast_v4().(&self, multiaddr: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, interface: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#)
1068 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1069 let mreq = ip_mreqrust-analyzer cargo libc 0.2.189 unix/linux_like/ip_mreq# {
1070 imr_multiaddrrust-analyzer cargo libc 0.2.189 unix/linux_like/ip_mreq#imr_multiaddr.: ip2in_addrrust-analyzer cargo net2 0.2.39 ext/ip2in_addr().(multiaddr),
1071 imr_interfacerust-analyzer cargo libc 0.2.189 unix/linux_like/ip_mreq#imr_interface.: ip2in_addrrust-analyzer cargo net2 0.2.39 ext/ip2in_addr().(interface),
1072 };
1073 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_ADD_MEMBERSHIPrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_ADD_MEMBERSHIP., mreq)
1074 }
1075
1076 #[cfg(not(target_os = "nto"))]
1077 fn join_multicast_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]join_multicast_v6().(&self, multiaddr: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, interface: u32)
1078 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1079 let mreq = ipv6_mreqrust-analyzer cargo libc 0.2.189 unix/ipv6_mreq# {
1080 ipv6mr_multiaddrrust-analyzer cargo libc 0.2.189 unix/ipv6_mreq#ipv6mr_multiaddr.: ip2in6_addrrust-analyzer cargo net2 0.2.39 ext/ip2in6_addr().(multiaddr),
1081 ipv6mr_interfacerust-analyzer cargo libc 0.2.189 unix/ipv6_mreq#ipv6mr_interface.: to_ipv6mr_interfacerust-analyzer cargo net2 0.2.39 ext/to_ipv6mr_interface().(interface),
1082 };
1083 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_ADD_MEMBERSHIPrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_ADD_MEMBERSHIP.,
1084 mreq)
1085 }
1086
1087 #[cfg(target_os = "nto")]
1088 fn join_multicast_v6(&self, _: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, _: u32)
1089 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1090 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::new(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Unsupportedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Unsupported#, "not supported by platform"))
1091 }
1092
1093 fn leave_multicast_v4rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]leave_multicast_v4().(&self, multiaddr: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, interface: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#)
1094 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1095 let mreq = ip_mreqrust-analyzer cargo libc 0.2.189 unix/linux_like/ip_mreq# {
1096 imr_multiaddrrust-analyzer cargo libc 0.2.189 unix/linux_like/ip_mreq#imr_multiaddr.: ip2in_addrrust-analyzer cargo net2 0.2.39 ext/ip2in_addr().(multiaddr),
1097 imr_interfacerust-analyzer cargo libc 0.2.189 unix/linux_like/ip_mreq#imr_interface.: ip2in_addrrust-analyzer cargo net2 0.2.39 ext/ip2in_addr().(interface),
1098 };
1099 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_DROP_MEMBERSHIPrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_DROP_MEMBERSHIP., mreq)
1100 }
1101
1102 #[cfg(not(target_os = "nto"))]
1103 fn leave_multicast_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]leave_multicast_v6().(&self, multiaddr: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, interface: u32)
1104 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1105 let mreq = ipv6_mreqrust-analyzer cargo libc 0.2.189 unix/ipv6_mreq# {
1106 ipv6mr_multiaddrrust-analyzer cargo libc 0.2.189 unix/ipv6_mreq#ipv6mr_multiaddr.: ip2in6_addrrust-analyzer cargo net2 0.2.39 ext/ip2in6_addr().(multiaddr),
1107 ipv6mr_interfacerust-analyzer cargo libc 0.2.189 unix/ipv6_mreq#ipv6mr_interface.: to_ipv6mr_interfacerust-analyzer cargo net2 0.2.39 ext/to_ipv6mr_interface().(interface),
1108 };
1109 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_DROP_MEMBERSHIPrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_DROP_MEMBERSHIP.,
1110 mreq)
1111 }
1112
1113 #[cfg(target_os = "nto")]
1114 fn leave_multicast_v6(&self, _: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, _: u32)
1115 -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1116 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::new(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Unsupportedrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Unsupported#, "not supported by platform"))
1117 }
1118
1119 fn set_read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_read_timeout_ms().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1120 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVTIMEO.,
1121 ms2timeoutrust-analyzer cargo net2 0.2.39 ext/ms2timeout().(dur))
1122 }
1123
1124 fn read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]read_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
1125 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_RCVTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_RCVTIMEO.)
1126 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(timeout2msrust-analyzer cargo net2 0.2.39 ext/timeout2ms().)
1127 }
1128
1129 fn set_write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_write_timeout_ms().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1130 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDTIMEO.,
1131 ms2timeoutrust-analyzer cargo net2 0.2.39 ext/ms2timeout().(dur))
1132 }
1133
1134 fn write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]write_timeout_ms().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>> {
1135 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_SNDTIMEOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_SNDTIMEO.)
1136 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(timeout2msrust-analyzer cargo net2 0.2.39 ext/timeout2ms().)
1137 }
1138
1139 fn set_read_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_read_timeout().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1140 self.set_read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_read_timeout_ms().(dur.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(dur2msrust-analyzer cargo net2 0.2.39 ext/dur2ms().))
1141 }
1142
1143 fn read_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]read_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
1144 self.read_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]read_timeout_ms().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|o| o.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ms2durrust-analyzer cargo net2 0.2.39 ext/ms2dur().))
1145 }
1146
1147 fn set_write_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_write_timeout().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1148 self.set_write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_write_timeout_ms().(dur.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(dur2msrust-analyzer cargo net2 0.2.39 ext/dur2ms().))
1149 }
1150
1151 fn write_timeoutrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]write_timeout().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
1152 self.write_timeout_msrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]write_timeout_ms().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|o| o.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ms2durrust-analyzer cargo net2 0.2.39 ext/ms2dur().))
1153 }
1154
1155 fn take_errorrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>> {
1156 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_ERRORrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_ERROR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2errrust-analyzer cargo net2 0.2.39 ext/int2err().)
1157 }
1158
1159 fn connectrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]connect().<A: ToSocketAddrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#>(&self, addr: A) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1160 do_connectrust-analyzer cargo net2 0.2.39 ext/do_connect().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), addr)
1161 }
1162
1163 #[cfg(unix)]
1164 fn sendrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]send().(&self, buf: &[u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
1165 unsafe {
1166 ::cvtrust-analyzer cargo net2 0.2.39 cvt().(sendrust-analyzer cargo libc 0.2.189 send().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().() as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, buf.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().() as *const _, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), 0)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|n| n as usize)
1167 }
1168 }
1169
1170 #[cfg(target_os = "wasi")]
1171 fn send(&self, buf: &[u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
1172 let _so_datalen: *mut sysrust-analyzer cargo net2 0.2.39 sys/::crust-analyzer cargo net2 0.2.39 sys/c/::size_trust-analyzer cargo libc 0.2.189 unix/size_t# = &mut 0;
1173 unsafe {
1174 let _errno = libcrust-analyzer cargo libc 0.2.189 crate/::__wasi_sock_send(
1175 selfrust-analyzer cargo net2 0.2.39 ext/.as_sock() as libcrust-analyzer cargo libc 0.2.189 crate/::__wasi_fd_t,
1176 buf.as_ptr() as *const _,
1177 buf.len(),
1178 0,
1179 _so_datalen,
1180 );
1181 // TODO: handle errno
1182 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((*_so_datalen) as usize)
1183 }
1184 }
1185
1186 #[cfg(windows)]
1187 fn send(&self, buf: &[u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
1188 let len = ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(buf.len(), c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#::max_value() as usize);
1189 let buf = &buf[..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#len];
1190 unsafe {
1191 ::cvtrust-analyzer cargo net2 0.2.39 cvt().(sendrust-analyzer cargo libc 0.2.189 send().(selfrust-analyzer cargo net2 0.2.39 ext/.as_sock(), buf.as_ptr() as *const _, len as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, 0))
1192 .map(|n| n as usize)
1193 }
1194 }
1195
1196 #[cfg(unix)]
1197 fn recvrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]recv().(&self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
1198 unsafe {
1199 ::cvtrust-analyzer cargo net2 0.2.39 cvt().(recvrust-analyzer cargo libc 0.2.189 recv().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), buf.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().() as *mut _, buf.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), 0))
1200 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|n| n as usize)
1201 }
1202 }
1203
1204 #[cfg(target_os = "wasi")]
1205 fn recv(&self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
1206 let _ro_datalen: *mut sysrust-analyzer cargo net2 0.2.39 sys/::crust-analyzer cargo net2 0.2.39 sys/c/::size_trust-analyzer cargo libc 0.2.189 unix/size_t# = &mut 0;
1207 let _ro_flags: *mut sysrust-analyzer cargo net2 0.2.39 sys/::crust-analyzer cargo net2 0.2.39 sys/c/::__wasi_roflags_t = &mut 0;
1208 unsafe {
1209 let _errno = __wasi_sock_recv(
1210 selfrust-analyzer cargo net2 0.2.39 ext/.as_sock(),
1211 buf.as_mut_ptr() as *mut _,
1212 buf.len(),
1213 0,
1214 _ro_datalen,
1215 _ro_flags,
1216 );
1217 // TODO: handle errno
1218 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((*_ro_datalen) as usize)
1219 }
1220 }
1221
1222 #[cfg(windows)]
1223 fn recv(&self, buf: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
1224 let len = ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(buf.len(), c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#::max_value() as usize);
1225 let buf = &mut buf[..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#len];
1226 unsafe {
1227 ::cvtrust-analyzer cargo net2 0.2.39 cvt().(recvrust-analyzer cargo libc 0.2.189 recv().(selfrust-analyzer cargo net2 0.2.39 ext/.as_sock(), buf.as_mut_ptr() as *mut _, buf.len() as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, 0))
1228 .map(|n| n as usize)
1229 }
1230 }
1231
1232 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/impl#[UdpSocket][UdpSocketExt]set_nonblocking().(&self, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1233 set_nonblockingrust-analyzer cargo net2 0.2.39 ext/set_nonblocking().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), nonblocking)
1234 }
1235 }
1236
1237 fn do_connectrust-analyzer cargo net2 0.2.39 ext/do_connect().<A: ToSocketAddrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#>(sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, addr: A) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1238 let err = iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Other#,
1239 "no socket addresses resolved");
1240 let addrs = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(addr.to_socket_addrsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/socket_addr/ToSocketAddrs#to_socket_addrs().());
1241 let sys = sysrust-analyzer cargo net2 0.2.39 sys/::Socketrust-analyzer cargo net2 0.2.39 sys/Socket#::from_innerrust-analyzer cargo net2 0.2.39 sys/impl#[Socket][FromInner]from_inner().(sock);
1242 let sock = socketrust-analyzer cargo net2 0.2.39 socket/::Socketrust-analyzer cargo net2 0.2.39 socket/Socket#::from_innerrust-analyzer cargo net2 0.2.39 socket/impl#[Socket][FromInner]from_inner().(sys);
1243 let ret = addrs.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err), |prev, addr| {
1244 prev.or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]or_else().(|_| sock.connectrust-analyzer cargo net2 0.2.39 socket/impl#[Socket]connect().(&addr))
1245 });
1246 memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::forgetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/forget().(sock);
1247 return ret
1248 }
1249
1250 #[cfg(unix)]
1251 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/set_nonblocking().(sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1252 let mut nonblocking = nonblocking as c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#;
1253 ::cvtrust-analyzer cargo net2 0.2.39 cvt().(unsafe {
1254 ioctlrust-analyzer cargo libc 0.2.189 ioctl().(sock, FIONBIOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/FIONBIO., &mut nonblocking)
1255 }).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|_| ())
1256 }
1257
1258 #[cfg(target_os = "wasi")]
1259 fn set_nonblocking(_sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, _nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1260 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1261 }
1262
1263 #[cfg(windows)]
1264 fn set_nonblocking(sock: Socketrust-analyzer cargo net2 0.2.39 ext/Socket#, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1265 let mut nonblocking = nonblocking as c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#;
1266 ::cvtrust-analyzer cargo net2 0.2.39 cvt().(unsafe {
1267 ioctlsocket(sock, FIONBIOrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/FIONBIO. as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, &mut nonblocking)
1268 }).map(|_| ())
1269 }
1270
1271 #[cfg(any(unix, target_os = "wasi"))]
1272 fn ip2in_addrrust-analyzer cargo net2 0.2.39 ext/ip2in_addr().(ip: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#) -> in_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr# {
1273 let oct = ip.octetsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]octets().();
1274 in_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr# {
1275 s_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr#s_addr.: ::htonrust-analyzer cargo net2 0.2.39 hton().(((oct[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().24) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
1276 ((oct[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
1277 ((oct[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().
1278 ((oct[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). as u32) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().0)),
1279 }
1280 }
1281
1282 #[cfg(windows)]
1283 fn ip2in_addr(ip: &Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#) -> in_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr# {
1284 let oct = ip.octets();
1285 unsafe {
1286 let mut S_un: in_addr_S_un = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().();
1287 *S_un.S_addr_mut() = ::htonrust-analyzer cargo net2 0.2.39 hton().(((oct[0] as u32) << 24) |
1288 ((oct[1] as u32) << 16) |
1289 ((oct[2] as u32) << 8) |
1290 ((oct[3] as u32) << 0));
1291 in_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr# {
1292 S_un: S_un,
1293 }
1294 }
1295 }
1296
1297 fn in_addr2iprust-analyzer cargo net2 0.2.39 ext/in_addr2ip().(ip: &in_addrrust-analyzer cargo libc 0.2.189 unix/linux_like/in_addr#) -> Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr# {
1298 let h_addr = crust-analyzer cargo net2 0.2.39 sys/c/::in_addr_to_u32rust-analyzer cargo net2 0.2.39 sys/c/in_addr_to_u32().(ip);
1299
1300 let a: u8 = (h_addr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().24) as u8;
1301 let b: u8 = (h_addr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().16) as u8;
1302 let c: u8 = (h_addr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().8) as u8;
1303 let d: u8 = (h_addr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().0) as u8;
1304
1305 Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(a,b,c,d)
1306 }
1307
1308 #[cfg(target_os = "android")]
1309 fn to_ipv6mr_interface(value: u32) -> c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# {
1310 value as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#
1311 }
1312
1313 #[cfg(not(target_os = "android"))]
1314 fn to_ipv6mr_interfacerust-analyzer cargo net2 0.2.39 ext/to_ipv6mr_interface().(value: u32) -> c_uintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_uint# {
1315 value as c_uintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_uint#
1316 }
1317
1318 fn ip2in6_addrrust-analyzer cargo net2 0.2.39 ext/ip2in6_addr().(ip: &Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#) -> in6_addrrust-analyzer cargo libc 0.2.189 unix/in6_addr# {
1319 let mut ret: in6_addrrust-analyzer cargo libc 0.2.189 unix/in6_addr# = unsafe { memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::zeroedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/zeroed().() };
1320 let seg = ip.segmentsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]segments().();
1321 let bytes = [
1322 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1323 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1324 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1325 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1326 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1327 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1328 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1329 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1330 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1331 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1332 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1333 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1334 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1335 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1336 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8,
1337 (seg[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().0) as u8,
1338 ];
1339 #[cfg(windows)] unsafe { *ret.u.Byte_mut() = bytes; }
1340 #[cfg(not(windows))] { ret.s6_addrrust-analyzer cargo libc 0.2.189 unix/in6_addr#s6_addr. = bytes; }
1341
1342 return ret
1343 }
1344
1345 impl TcpListenerExtrust-analyzer cargo net2 0.2.39 ext/TcpListenerExt# for TcpListenerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/tcp/TcpListener# {
1346 fn set_ttlrust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]set_ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1347 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL., ttl as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1348 }
1349
1350 fn ttlrust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]ttl().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<u32> {
1351 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().::<c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#>(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL.)
1352 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|b| b as u32)
1353 }
1354
1355 fn set_only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]set_only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1356 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY., only_v6 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1357 }
1358
1359 fn only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]only_v6().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
1360 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
1361 }
1362
1363 fn take_errorrust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>> {
1364 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_ERRORrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_ERROR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2errrust-analyzer cargo net2 0.2.39 ext/int2err().)
1365 }
1366
1367 fn set_nonblockingrust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]set_nonblocking().(&self, nonblocking: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1368 set_nonblockingrust-analyzer cargo net2 0.2.39 ext/set_nonblocking().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), nonblocking)
1369 }
1370
1371 fn set_lingerrust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]set_linger().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1372 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_LINGERrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_LINGER., dur2lingerrust-analyzer cargo net2 0.2.39 ext/dur2linger().(dur))
1373 }
1374
1375 fn lingerrust-analyzer cargo net2 0.2.39 ext/impl#[TcpListener][TcpListenerExt]linger().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
1376 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_LINGERrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_LINGER.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(linger2durrust-analyzer cargo net2 0.2.39 ext/linger2dur().)
1377 }
1378 }
1379
1380 impl TcpBuilderrust-analyzer cargo net2 0.2.39 tcp/TcpBuilder# {
1381 /// Sets the value for the `IP_TTL` option on this socket.
1382 ///
1383 /// This is the same as [`TcpStreamExt::set_ttl`][other].
1384 ///
1385 /// [other]: trait.TcpStreamExt.html#tymethod.set_ttl
1386 pub fn ttlrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&Selfrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]> {
1387 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL., ttl as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1388 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| self)
1389 }
1390
1391 /// Sets the value for the `IPV6_V6ONLY` option on this socket.
1392 ///
1393 /// This is the same as [`TcpStreamExt::set_only_v6`][other].
1394 ///
1395 /// [other]: trait.TcpStreamExt.html#tymethod.set_only_v6
1396 pub fn only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&Selfrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]> {
1397 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY., only_v6 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1398 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| self)
1399 }
1400
1401 /// Set value for the `SO_REUSEADDR` option on this socket.
1402 ///
1403 /// This indicates that further calls to `bind` may allow reuse of local
1404 /// addresses. For IPv4 sockets this means that a socket may bind even when
1405 /// there's a socket already listening on this port.
1406 pub fn reuse_addressrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]reuse_address().(&self, reuse: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&Selfrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]> {
1407 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_REUSEADDRrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_REUSEADDR.,
1408 reuse as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| self)
1409 }
1410
1411 /// Check the `SO_REUSEADDR` option on this socket.
1412 pub fn get_reuse_addressrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]get_reuse_address().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
1413 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_REUSEADDRrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_REUSEADDR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
1414 }
1415
1416 /// Get the value of the `SO_ERROR` option on this socket.
1417 ///
1418 /// This will retrieve the stored error in the underlying socket, clearing
1419 /// the field in the process. This can be useful for checking errors between
1420 /// calls.
1421 pub fn take_errorrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>> {
1422 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_ERRORrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_ERROR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2errrust-analyzer cargo net2 0.2.39 ext/int2err().)
1423 }
1424
1425 /// Sets the linger option for this socket
1426 fn set_lingerrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]set_linger().(&self, dur: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
1427 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_LINGERrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_LINGER., dur2lingerrust-analyzer cargo net2 0.2.39 ext/dur2linger().(dur))
1428 }
1429
1430 /// Gets the linger option for this socket
1431 fn lingerrust-analyzer cargo net2 0.2.39 ext/impl#[TcpBuilder]linger().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>> {
1432 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_LINGERrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_LINGER.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(linger2durrust-analyzer cargo net2 0.2.39 ext/linger2dur().)
1433 }
1434 }
1435
1436 impl UdpBuilderrust-analyzer cargo net2 0.2.39 udp/UdpBuilder# {
1437 /// Sets the value for the `IP_TTL` option on this socket.
1438 ///
1439 /// This is the same as [`TcpStreamExt::set_ttl`][other].
1440 ///
1441 /// [other]: trait.TcpStreamExt.html#tymethod.set_ttl
1442 pub fn ttlrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]ttl().(&self, ttl: u32) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&Selfrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]> {
1443 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), IPPROTO_IPrust-analyzer cargo libc 0.2.189 unix/IPPROTO_IP., IP_TTLrust-analyzer cargo libc 0.2.189 unix/linux_like/IP_TTL., ttl as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1444 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| self)
1445 }
1446
1447 /// Sets the value for the `IPV6_V6ONLY` option on this socket.
1448 ///
1449 /// This is the same as [`TcpStream::only_v6`][other].
1450 ///
1451 /// [other]: struct.TcpBuilder.html#method.only_v6
1452 pub fn only_v6rust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]only_v6().(&self, only_v6: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&Selfrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]> {
1453 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), vrust-analyzer cargo net2 0.2.39 ext/v().(IPPROTO_IPV6rust-analyzer cargo libc 0.2.189 unix/IPPROTO_IPV6.), IPV6_V6ONLYrust-analyzer cargo libc 0.2.189 unix/linux_like/IPV6_V6ONLY., only_v6 as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#)
1454 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| self)
1455 }
1456
1457 /// Set value for the `SO_REUSEADDR` option on this socket.
1458 ///
1459 /// This is the same as [`TcpBuilder::reuse_address`][other].
1460 ///
1461 /// [other]: struct.TcpBuilder.html#method.reuse_address
1462 pub fn reuse_addressrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]reuse_address().(&self, reuse: bool) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<&Selfrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]> {
1463 set_optrust-analyzer cargo net2 0.2.39 ext/set_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_REUSEADDRrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_REUSEADDR.,
1464 reuse as c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| self)
1465 }
1466
1467 /// Check the `SO_REUSEADDR` option on this socket.
1468 pub fn get_reuse_addressrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]get_reuse_address().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
1469 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_REUSEADDRrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_REUSEADDR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2boolrust-analyzer cargo net2 0.2.39 ext/int2bool().)
1470 }
1471
1472 /// Get the value of the `SO_ERROR` option on this socket.
1473 ///
1474 /// This will retrieve the stored error in the underlying socket, clearing
1475 /// the field in the process. This can be useful for checking errors between
1476 /// calls.
1477 pub fn take_errorrust-analyzer cargo net2 0.2.39 ext/impl#[UdpBuilder]take_error().(&self) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>> {
1478 get_optrust-analyzer cargo net2 0.2.39 ext/get_opt().(self.as_sockrust-analyzer cargo net2 0.2.39 ext/impl#[T][AsSock]as_sock().(), SOL_SOCKETrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SOL_SOCKET., SO_ERRORrust-analyzer cargo libc 0.2.189 unix/linux_like/linux/arch/generic/SO_ERROR.).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(int2errrust-analyzer cargo net2 0.2.39 ext/int2err().)
1479 }
1480 }