Trait DatagramSocketSendExt

Source
pub trait DatagramSocketSendExt: DatagramSocketSend {
    // Provided methods
    fn send(&self, buf: &[u8]) -> impl Future<Output = Result<usize>> { ... }
    fn send_to(
        &self,
        buf: &[u8],
        addr: SocketAddr,
    ) -> impl Future<Output = Result<usize>> { ... }
    fn send_many(
        &self,
        bufs: &[ReadBuf<'_>],
    ) -> impl Future<Output = Result<usize>> { ... }
    fn try_send(&self, buf: &[u8]) -> Result<usize> { ... }
    fn try_send_many(&self, bufs: &[ReadBuf<'_>]) -> Result<usize> { ... }
}
Expand description

Writes datagrams to a socket.

Implemented as an extension trait, adding utility methods to all DatagramSocketSend types. Callers will tend to import this trait instead of DatagramSocketSend.

Provided Methods§

Source

fn send(&self, buf: &[u8]) -> impl Future<Output = Result<usize>>

Sends data on the socket to the remote address that the socket is connected to.

Source

fn send_to( &self, buf: &[u8], addr: SocketAddr, ) -> impl Future<Output = Result<usize>>

Sends data on the socket to the given address. On success, returns the number of bytes written.

Source

fn send_many(&self, bufs: &[ReadBuf<'_>]) -> impl Future<Output = Result<usize>>

Sends multiple data packets on the socket to the to the remote address that the socket is connected to. On success, returns the number of packets sent.

Source

fn try_send(&self, buf: &[u8]) -> Result<usize>

Source

fn try_send_many(&self, bufs: &[ReadBuf<'_>]) -> Result<usize>

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§