Skip to main content

UdpSocket

Trait UdpSocket 

Source
pub trait UdpSocket {
    // Required methods
    fn recv<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = IoResult<(usize, SocketAddr)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        buf: &'life1 [u8],
        target: &'life2 SocketAddr,
    ) -> Pin<Box<dyn Future<Output = IoResult<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn local_addr(&self) -> IoResult<SocketAddr>;
}
Expand description

Trait for a locally bound Udp socket that can send and receive datagrams.

These objects are returned by instances of UdpProvider.

Required Methods§

Source

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

Wait for an incoming datagram; return it along its address.

Source

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

Send a datagram to the provided address.

Source

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

Return the local address that this socket is bound to.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl UdpSocket for tor_rtcompat::impls::async_std::net::UdpSocket

Source§

impl UdpSocket for tor_rtcompat::impls::tokio::net::UdpSocket

Source§

impl UdpSocket for tor_rtcompat::impls::smol::net::UdpSocket