pub struct UdpSocket { /* private fields */ }net only.Expand description
A UDP socket.
UDP is “connectionless”, unlike TCP. Meaning, regardless of what address
you’ve bound to, a UdpSocket is free to communicate with many different
remotes. There are basically two main ways to use UdpSocket:
- one to many:
bindand usesend_toandrecv_fromto communicate with many different addresses - one to one:
connectand associate with a single address, usingsendandrecvto communicate only with that remote address
§Examples
Bind and connect a pair of sockets and send a packet:
use std::net::SocketAddr;
use compio_net::UdpSocket;
let first_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
let second_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
// bind sockets
let mut socket = UdpSocket::bind(first_addr).await.unwrap();
let first_addr = socket.local_addr().unwrap();
let mut other_socket = UdpSocket::bind(second_addr).await.unwrap();
let second_addr = other_socket.local_addr().unwrap();
// connect sockets
socket.connect(second_addr).await.unwrap();
other_socket.connect(first_addr).await.unwrap();
let buf = Vec::with_capacity(12);
// write data
socket.send("Hello world!").await.unwrap();
// read data
let (n_bytes, buf) = other_socket.recv(buf).await.unwrap();
assert_eq!(n_bytes, buf.len());
assert_eq!(buf, b"Hello world!");Send and receive packets without connecting:
use std::net::SocketAddr;
use compio_net::UdpSocket;
use socket2::SockAddr;
let first_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
let second_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
// bind sockets
let mut socket = UdpSocket::bind(first_addr).await.unwrap();
let first_addr = socket.local_addr().unwrap();
let mut other_socket = UdpSocket::bind(second_addr).await.unwrap();
let second_addr = other_socket.local_addr().unwrap();
let buf = Vec::with_capacity(32);
// write data
socket.send_to("hello world", second_addr).await.unwrap();
// read data
let ((n_bytes, addr), buf) = other_socket.recv_from(buf).await.unwrap();
assert_eq!(addr, first_addr);
assert_eq!(n_bytes, buf.len());
assert_eq!(buf, b"hello world");Implementations§
Source§impl UdpSocket
impl UdpSocket
Sourcepub async fn bind(addr: impl ToSocketAddrsAsync) -> Result<UdpSocket, Error>
pub async fn bind(addr: impl ToSocketAddrsAsync) -> Result<UdpSocket, Error>
Creates a new UDP socket and attempt to bind it to the addr provided.
Sourcepub async fn connect(&self, addr: impl ToSocketAddrsAsync) -> Result<(), Error>
pub async fn connect(&self, addr: impl ToSocketAddrsAsync) -> Result<(), Error>
Connects this UDP socket to a remote address, allowing the send and
recv to be used to send data and also applies filters to only
receive data from the specified address.
Note that usually, a successful connect call does not specify
that there is a remote server listening on the port, rather, such an
error would only be detected after the first send.
Sourcepub fn from_std(socket: UdpSocket) -> Result<UdpSocket, Error>
pub fn from_std(socket: UdpSocket) -> Result<UdpSocket, Error>
Creates new UdpSocket from a std::net::UdpSocket.
Sourcepub fn close(self) -> impl Future<Output = Result<(), Error>>
pub fn close(self) -> impl Future<Output = Result<(), Error>>
Close the socket. If the returned future is dropped before polling, the socket won’t be closed.
See TcpStream::close for more details.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr, Error>
pub fn peer_addr(&self) -> Result<SocketAddr, Error>
Returns the socket address of the remote peer this socket was connected to.
§Examples
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use compio_net::UdpSocket;
use socket2::SockAddr;
let socket = UdpSocket::bind("127.0.0.1:34254")
.await
.expect("couldn't bind to address");
socket
.connect("192.168.0.1:41203")
.await
.expect("couldn't connect to address");
assert_eq!(
socket.peer_addr().unwrap(),
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(192, 168, 0, 1), 41203))
);Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Returns the local address that this socket is bound to.
§Example
use std::net::SocketAddr;
use compio_net::UdpSocket;
use socket2::SockAddr;
let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap();
let sock = UdpSocket::bind(&addr).await.unwrap();
// the address the socket is bound to
let local_addr = sock.local_addr().unwrap();
assert_eq!(local_addr, addr);Sourcepub async fn recv<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoBufMut,
pub async fn recv<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoBufMut,
Receives a packet of data from the socket into the buffer, returning the original buffer and quantity of data received.
Sourcepub async fn recv_vectored<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoVectoredBufMut,
pub async fn recv_vectored<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoVectoredBufMut,
Receives a packet of data from the socket into the buffer, returning the original buffer and quantity of data received.
Sourcepub async fn recv_managed(&self, len: usize) -> Result<Option<BufferRef>, Error>
pub async fn recv_managed(&self, len: usize) -> Result<Option<BufferRef>, Error>
Read some bytes from this source and return a BufferRef.
If len == 0, will use buffer pool’s inner buffer size as the max len;
if len > 0, min(len, inner buffer size) will be the read max len.
Sourcepub fn recv_multi(
&self,
len: usize,
) -> impl Stream<Item = Result<BufferRef, Error>>
pub fn recv_multi( &self, len: usize, ) -> impl Stream<Item = Result<BufferRef, Error>>
Read some bytes from this source and return a stream of BufferRefs.
If len == 0, will use buffer pool’s inner buffer size as the max len
of each buffer; if len > 0, min(len, inner buffer size) will be
the read max len of each buffer.
Sourcepub async fn send<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoBuf,
pub async fn send<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoBuf,
Sends some data to the socket from the buffer, returning the original buffer and quantity of data sent.
Sourcepub async fn send_vectored<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoVectoredBuf,
pub async fn send_vectored<T>(&self, buffer: T) -> BufResult<usize, T>where
T: IoVectoredBuf,
Sends some data to the socket from the buffer, returning the original buffer and quantity of data sent.
Sourcepub async fn recv_from<T>(&self, buffer: T) -> BufResult<(usize, SocketAddr), T>where
T: IoBufMut,
pub async fn recv_from<T>(&self, buffer: T) -> BufResult<(usize, SocketAddr), T>where
T: IoBufMut,
Receives a single datagram message on the socket. On success, returns the number of bytes received and the origin.
Sourcepub async fn recv_from_vectored<T>(
&self,
buffer: T,
) -> BufResult<(usize, SocketAddr), T>where
T: IoVectoredBufMut,
pub async fn recv_from_vectored<T>(
&self,
buffer: T,
) -> BufResult<(usize, SocketAddr), T>where
T: IoVectoredBufMut,
Receives a single datagram message on the socket. On success, returns the number of bytes received and the origin.
Sourcepub async fn recv_from_managed(
&self,
len: usize,
) -> Result<Option<(BufferRef, SocketAddr)>, Error>
pub async fn recv_from_managed( &self, len: usize, ) -> Result<Option<(BufferRef, SocketAddr)>, Error>
Read some bytes from this source and the runtime’s buffer pool and
return a BufferRef with the sender address.
If len == 0, will use buffer pool’s inner buffer size as the max len;
if len > 0, min(len, inner buffer size) will be the read max len
Sourcepub fn recv_from_multi(
&self,
) -> impl Stream<Item = Result<RecvFromMultiResult, Error>>
pub fn recv_from_multi( &self, ) -> impl Stream<Item = Result<RecvFromMultiResult, Error>>
Read some bytes from this source and the runtime’s buffer pool and
return a stream of RecvFromMultiResult.
Sourcepub async fn recv_msg<T, C>(
&self,
buffer: T,
control: C,
) -> BufResult<(usize, usize, SocketAddr), (T, C)>
pub async fn recv_msg<T, C>( &self, buffer: T, control: C, ) -> BufResult<(usize, usize, SocketAddr), (T, C)>
Receives a single datagram message and ancillary data on the socket. On success, returns the number of bytes received and the origin.
Sourcepub async fn recv_msg_vectored<T, C>(
&self,
buffer: T,
control: C,
) -> BufResult<(usize, usize, SocketAddr), (T, C)>where
T: IoVectoredBufMut,
C: IoBufMut,
pub async fn recv_msg_vectored<T, C>(
&self,
buffer: T,
control: C,
) -> BufResult<(usize, usize, SocketAddr), (T, C)>where
T: IoVectoredBufMut,
C: IoBufMut,
Receives a single datagram message and ancillary data on the socket. On success, returns the number of bytes received and the origin.
Sourcepub async fn recv_msg_managed<C>(
&self,
len: usize,
control: C,
) -> Result<Option<(BufferRef, C, SocketAddr)>, Error>where
C: IoBufMut,
pub async fn recv_msg_managed<C>(
&self,
len: usize,
control: C,
) -> Result<Option<(BufferRef, C, SocketAddr)>, Error>where
C: IoBufMut,
Receives a single datagram message on the socket from the runtime’s buffer pool, together with ancillary data. The ancillary data buffer is provided by the caller.
If len == 0, will use buffer pool’s inner buffer size as the max len;
if len > 0, min(len, inner buffer size) will be the read max len
Sourcepub fn recv_msg_multi(
&self,
control_len: usize,
) -> impl Stream<Item = Result<RecvMsgMultiResult, Error>>
pub fn recv_msg_multi( &self, control_len: usize, ) -> impl Stream<Item = Result<RecvMsgMultiResult, Error>>
Receives multiple single datagram messages and ancillary data on the socket from the runtime’s buffer pool.
Sourcepub async fn send_to<T>(
&self,
buffer: T,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, T>where
T: IoBuf,
pub async fn send_to<T>(
&self,
buffer: T,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, T>where
T: IoBuf,
Sends data on the socket to the given address. On success, returns the number of bytes sent.
Sourcepub async fn send_to_vectored<T>(
&self,
buffer: T,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, T>where
T: IoVectoredBuf,
pub async fn send_to_vectored<T>(
&self,
buffer: T,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, T>where
T: IoVectoredBuf,
Sends data on the socket to the given address. On success, returns the number of bytes sent.
Sourcepub async fn send_msg<T, C>(
&self,
buffer: T,
control: C,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, (T, C)>
pub async fn send_msg<T, C>( &self, buffer: T, control: C, addr: impl ToSocketAddrsAsync, ) -> BufResult<usize, (T, C)>
Sends data on the socket to the given address accompanied by ancillary data. On success, returns the number of bytes sent.
Sourcepub async fn send_msg_vectored<T, C>(
&self,
buffer: T,
control: C,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, (T, C)>where
T: IoVectoredBuf,
C: IoBuf,
pub async fn send_msg_vectored<T, C>(
&self,
buffer: T,
control: C,
addr: impl ToSocketAddrsAsync,
) -> BufResult<usize, (T, C)>where
T: IoVectoredBuf,
C: IoBuf,
Sends data on the socket to the given address accompanied by ancillary data. On success, returns the number of bytes sent.
Sourcepub async fn send_zerocopy<T>(
&self,
buf: T,
) -> BufResult<usize, impl Future<Output = T> + use<T>>where
T: IoBuf,
pub async fn send_zerocopy<T>(
&self,
buf: T,
) -> BufResult<usize, impl Future<Output = T> + use<T>>where
T: IoBuf,
Sends data on the socket with zero copy.
Returns the result of send and a future that resolves to the original buffer when the send is complete.
Sourcepub async fn send_zerocopy_vectored<T>(
&self,
buf: T,
) -> BufResult<usize, impl Future<Output = T> + use<T>>where
T: IoVectoredBuf,
pub async fn send_zerocopy_vectored<T>(
&self,
buf: T,
) -> BufResult<usize, impl Future<Output = T> + use<T>>where
T: IoVectoredBuf,
Sends vectored data on the socket with zero copy.
Returns the result of send and a future that resolves to the original buffer when the send is complete.
Sourcepub async fn send_to_zerocopy<A, T>(
&self,
buffer: T,
addr: A,
) -> BufResult<usize, impl Future<Output = T> + use<A, T>>where
A: ToSocketAddrsAsync,
T: IoBuf,
pub async fn send_to_zerocopy<A, T>(
&self,
buffer: T,
addr: A,
) -> BufResult<usize, impl Future<Output = T> + use<A, T>>where
A: ToSocketAddrsAsync,
T: IoBuf,
Sends data on the socket to the given address with zero copy.
Returns the result of send and a future that resolves to the original buffer when the send is complete.
Sourcepub async fn send_to_zerocopy_vectored<A, T>(
&self,
buffer: T,
addr: A,
) -> BufResult<usize, impl Future<Output = T> + use<A, T>>where
A: ToSocketAddrsAsync,
T: IoVectoredBuf,
pub async fn send_to_zerocopy_vectored<A, T>(
&self,
buffer: T,
addr: A,
) -> BufResult<usize, impl Future<Output = T> + use<A, T>>where
A: ToSocketAddrsAsync,
T: IoVectoredBuf,
Sends vectored data on the socket to the given address with zero copy.
Returns the result of send and a future that resolves to the original buffer when the send is complete.
Sourcepub async fn send_msg_zerocopy<A, T, C>(
&self,
buffer: T,
control: C,
addr: A,
) -> BufResult<usize, impl Future<Output = (T, C)> + use<A, T, C>>
pub async fn send_msg_zerocopy<A, T, C>( &self, buffer: T, control: C, addr: A, ) -> BufResult<usize, impl Future<Output = (T, C)> + use<A, T, C>>
Sends data with control message on the socket to the given address with zero copy.
Returns the result of send and a future that resolves to the original buffer when the send is complete.
Sourcepub async fn send_msg_zerocopy_vectored<A, T, C>(
&self,
buffer: T,
control: C,
addr: A,
) -> BufResult<usize, impl Future<Output = (T, C)> + use<A, T, C>>
pub async fn send_msg_zerocopy_vectored<A, T, C>( &self, buffer: T, control: C, addr: A, ) -> BufResult<usize, impl Future<Output = (T, C)> + use<A, T, C>>
Sends vectored data with control message on the socket to the given address with zero copy.
Returns the result of send and a future that resolves to the original buffer when the send is complete.
Sourcepub fn broadcast(&self) -> Result<bool, Error>
pub fn broadcast(&self) -> Result<bool, Error>
Gets the value of the SO_BROADCAST option for this socket.
For more information about this option, see set_broadcast.
Sourcepub fn set_broadcast(&self, on: bool) -> Result<(), Error>
pub fn set_broadcast(&self, on: bool) -> Result<(), Error>
Sets the value of the SO_BROADCAST option for this socket.
When enabled, this socket is allowed to send packets to a broadcast address.
Sourcepub fn multicast_loop_v4(&self) -> Result<bool, Error>
pub fn multicast_loop_v4(&self) -> Result<bool, Error>
Gets the value of the IP_MULTICAST_LOOP option for this socket.
For more information about this option, see set_multicast_loop_v4.
Sourcepub fn set_multicast_loop_v4(&self, on: bool) -> Result<(), Error>
pub fn set_multicast_loop_v4(&self, on: bool) -> Result<(), Error>
Sets the value of the IP_MULTICAST_LOOP option for this socket.
If enabled, multicast packets will be looped back to the local socket.
§Note
This may not have any effect on IPv6 sockets.
Sourcepub fn multicast_ttl_v4(&self) -> Result<u32, Error>
pub fn multicast_ttl_v4(&self) -> Result<u32, Error>
Gets the value of the IP_MULTICAST_TTL option for this socket.
For more information about this option, see set_multicast_ttl_v4.
Sourcepub fn set_multicast_ttl_v4(&self, ttl: u32) -> Result<(), Error>
pub fn set_multicast_ttl_v4(&self, ttl: u32) -> Result<(), Error>
Sets the value of the IP_MULTICAST_TTL option for this socket.
Indicates the time-to-live value of outgoing multicast packets for this socket. The default value is 1 which means that multicast packets don’t leave the local network unless explicitly requested.
§Note
This may not have any effect on IPv6 sockets.
Sourcepub fn multicast_loop_v6(&self) -> Result<bool, Error>
pub fn multicast_loop_v6(&self) -> Result<bool, Error>
Gets the value of the IPV6_MULTICAST_LOOP option for this socket.
For more information about this option, see set_multicast_loop_v6.
Sourcepub fn set_multicast_loop_v6(&self, on: bool) -> Result<(), Error>
pub fn set_multicast_loop_v6(&self, on: bool) -> Result<(), Error>
Sets the value of the IPV6_MULTICAST_LOOP option for this socket.
Controls whether this socket sees the multicast packets it sends itself.
§Note
This may not have any effect on IPv4 sockets.
Sourcepub fn ttl_v4(&self) -> Result<u32, Error>
pub fn ttl_v4(&self) -> Result<u32, Error>
Gets the value of the IP_TTL option for this socket.
For more information about this option, see set_ttl_v4.
Sourcepub fn set_ttl_v4(&self, ttl: u32) -> Result<(), Error>
pub fn set_ttl_v4(&self, ttl: u32) -> Result<(), Error>
Sets the value for the IP_TTL option on this socket.
This value sets the time-to-live field that is used in every packet sent from this socket.
Sourcepub fn tos_v4(&self) -> Result<u32, Error>
Available on neither Fuchsia nor Redox OS nor Solaris nor illumos nor Haiku.
pub fn tos_v4(&self) -> Result<u32, Error>
Gets the value of the IP_TOS option for this socket.
For more information about this option, see set_tos_v4.
Sourcepub fn set_tos_v4(&self, tos: u32) -> Result<(), Error>
Available on neither Fuchsia nor Redox OS nor Solaris nor illumos nor Haiku.
pub fn set_tos_v4(&self, tos: u32) -> Result<(), Error>
Sets the value for the IP_TOS option on this socket.
This value sets the type-of-service field that is used in every packet sent from this socket.
§Note
- This may not have any effect on IPv6 sockets.
Sourcepub fn join_multicast_v4(
&self,
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr,
) -> Result<(), Error>
pub fn join_multicast_v4( &self, multiaddr: &Ipv4Addr, interface: &Ipv4Addr, ) -> Result<(), Error>
Executes an operation of the IP_ADD_MEMBERSHIP type.
This function specifies a new multicast group for this socket to join.
The address must be a valid multicast address, and interface is the
address of the local interface with which the system should join the
multicast group. If it’s equal to INADDR_ANY then an appropriate
interface is chosen by the system.
Sourcepub fn join_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32,
) -> Result<(), Error>
pub fn join_multicast_v6( &self, multiaddr: &Ipv6Addr, interface: u32, ) -> Result<(), Error>
Executes an operation of the IPV6_ADD_MEMBERSHIP type.
This function specifies a new multicast group for this socket to join.
The address must be a valid multicast address, and interface is the
index of the interface to join/leave (or 0 to indicate any interface).
Sourcepub fn leave_multicast_v4(
&self,
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr,
) -> Result<(), Error>
pub fn leave_multicast_v4( &self, multiaddr: &Ipv4Addr, interface: &Ipv4Addr, ) -> Result<(), Error>
Executes an operation of the IP_DROP_MEMBERSHIP type.
For more information about this option, see join_multicast_v4.
Sourcepub fn leave_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32,
) -> Result<(), Error>
pub fn leave_multicast_v6( &self, multiaddr: &Ipv6Addr, interface: u32, ) -> Result<(), Error>
Executes an operation of the IPV6_DROP_MEMBERSHIP type.
For more information about this option, see join_multicast_v6.
Sourcepub fn take_error(&self) -> Result<Option<Error>, Error>
pub fn take_error(&self) -> Result<Option<Error>, Error>
Returns the value of the SO_ERROR option.
Trait Implementations§
Source§impl AsRawSocket for UdpSocket
Available on Windows only.
impl AsRawSocket for UdpSocket
Source§fn as_raw_socket(&self) -> u64
fn as_raw_socket(&self) -> u64
Source§impl AsSocket for UdpSocket
Available on Windows only.
impl AsSocket for UdpSocket
Source§fn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
Source§impl FromRawSocket for UdpSocket
Available on Windows only.
impl FromRawSocket for UdpSocket
SharedFd.Auto Trait Implementations§
impl Freeze for UdpSocket
impl RefUnwindSafe for UdpSocket
impl Send for UdpSocket
impl Sync for UdpSocket
impl Unpin for UdpSocket
impl UnsafeUnpin for UdpSocket
impl UnwindSafe for UdpSocket
Blanket Implementations§
§impl<T> AsFd for Twhere
T: AsSocket,
impl<T> AsFd for Twhere
T: AsSocket,
§fn as_fd(&self) -> BorrowedSocket<'_>
fn as_fd(&self) -> BorrowedSocket<'_>
as_fd function for Winsock, where an Fd is a Socket.§impl<T> AsRawFd for Twhere
T: AsRawSocket,
impl<T> AsRawFd for Twhere
T: AsRawSocket,
§impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
§fn as_raw_socketlike(&self) -> u64
fn as_raw_socketlike(&self) -> u64
§impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
§fn as_raw_socketlike(&self) -> u64
fn as_raw_socketlike(&self) -> u64
§impl<T> AsSocketlike for Twhere
T: AsSocket,
impl<T> AsSocketlike for Twhere
T: AsSocket,
§fn as_socketlike(&self) -> BorrowedSocket<'_>
fn as_socketlike(&self) -> BorrowedSocket<'_>
§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target. Read more§impl<T> AsSocketlike for Twhere
T: AsSocket,
impl<T> AsSocketlike for Twhere
T: AsSocket,
§fn as_socketlike(&self) -> BorrowedSocket<'_>
fn as_socketlike(&self) -> BorrowedSocket<'_>
§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FromRawFd for Twhere
T: FromRawSocket,
impl<T> FromRawFd for Twhere
T: FromRawSocket,
§unsafe fn from_raw_fd(raw_fd: u64) -> T
unsafe fn from_raw_fd(raw_fd: u64) -> T
from_raw_fd for use with Winsock API. Read more§impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
§unsafe fn from_raw_socketlike(raw: u64) -> T
unsafe fn from_raw_socketlike(raw: u64) -> T
Self from the raw value.§impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
impl<T> FromRawSocketlike for Twhere
T: FromRawSocket,
§unsafe fn from_raw_socketlike(raw: u64) -> T
unsafe fn from_raw_socketlike(raw: u64) -> T
Self from the raw value.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more