pub trait AsyncSendTo: DatagramSocketTypes {
// Required method
fn poll_send_to<B>(
self: Pin<&Self>,
cx: &mut Context<'_>,
buf: &[u8],
addr: B,
) -> Poll<Result<usize, Self::Error>>
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error>;
// Provided methods
fn next_send_to<'a, 'b, B>(
&'a self,
buf: &'b [u8],
addr: B,
) -> NextSendToFuture<'a, 'b, Self> ⓘ
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error> { ... }
fn send_to<B>(&self, buf: &[u8], addr: B) -> Result<usize, Self::Error>
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error> { ... }
}
Expand description
Trait for providing sent_to
functionality for asynchronous, datagram-based sockets.
Required Methods§
Sourcefn poll_send_to<B>(
self: Pin<&Self>,
cx: &mut Context<'_>,
buf: &[u8],
addr: B,
) -> Poll<Result<usize, Self::Error>>
fn poll_send_to<B>( self: Pin<&Self>, cx: &mut Context<'_>, buf: &[u8], addr: B, ) -> Poll<Result<usize, Self::Error>>
A non-blocking1, poll_*
version of std::net::UdpSocket::send_to
.
Note that while the spirit of this method intends for it to be non-blocking,
AllowStdUdpSocket
can block execution depending on the implementation details of the underlyingstd::net::UdpSocket
. ↩
Provided Methods§
Sourcefn next_send_to<'a, 'b, B>(
&'a self,
buf: &'b [u8],
addr: B,
) -> NextSendToFuture<'a, 'b, Self> ⓘ
fn next_send_to<'a, 'b, B>( &'a self, buf: &'b [u8], addr: B, ) -> NextSendToFuture<'a, 'b, Self> ⓘ
Returns a future that uses AsyncSendTo::poll_send_to
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.