Trait AsyncSendTo

Source
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§

Source

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>,

A non-blocking1, poll_* version of std::net::UdpSocket::send_to.


  1. 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 underlying std::net::UdpSocket

Provided Methods§

Source

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>,

Returns a future that uses AsyncSendTo::poll_send_to.

Source

fn send_to<B>(&self, buf: &[u8], addr: B) -> Result<usize, Self::Error>
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error>,

A synchronous version of AsyncSendTo::poll_send_to. If this isn’t overridden by the trait’s implementation, the default version will call poll_send_to() and panics if it returns Poll::Pending.

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.

Implementors§