AsyncUdpSocket

Trait AsyncUdpSocket 

Source
pub trait AsyncUdpSocket: Send + Sync {
    // Required methods
    fn local_addr(&self) -> Result<SocketAddr>;
    fn send_to<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 [u8],
        target: SocketAddr,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn recv_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(usize, SocketAddr)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn local_addr(&self) -> Result<SocketAddr>

Returns the local address this socket is bound to.

Source

fn send_to<'life0, 'life1, 'async_trait>( &'life0 self, buf: &'life1 [u8], target: SocketAddr, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends data to the given target address.

Source

fn recv_from<'life0, 'life1, 'async_trait>( &'life0 self, buf: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = Result<(usize, SocketAddr)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Receives data from the socket, returning the number of bytes and the source address.

Implementors§