Trait DnsUdpSocket

pub trait DnsUdpSocket:
    Sized
    + Send
    + Sync
    + Unpin {
    type Time: Time;

    // Required methods
    fn poll_recv_from(
        &self,
        cx: &mut Context<'_>,
        buf: &mut [u8],
    ) -> Poll<Result<(usize, SocketAddr), Error>>;
    fn poll_send_to(
        &self,
        cx: &mut Context<'_>,
        buf: &[u8],
        target: SocketAddr,
    ) -> Poll<Result<usize, Error>>;

    // Provided methods
    fn recv_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(usize, SocketAddr), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: Sync + 'async_trait { ... }
    fn send_to<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 [u8],
        target: SocketAddr,
    ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: Sync + 'async_trait { ... }
}
Expand description

Trait for DnsUdpSocket

Required Associated Types§

type Time: Time

Time implementation used for this type

Required Methods§

fn poll_recv_from( &self, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<(usize, SocketAddr), Error>>

Poll once Receive data from the socket and returns the number of bytes read and the address from where the data came on success.

fn poll_send_to( &self, cx: &mut Context<'_>, buf: &[u8], target: SocketAddr, ) -> Poll<Result<usize, Error>>

Poll once to send data to the given address.

Provided Methods§

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

Receive data from the socket and returns the number of bytes read and the address from where the data came on success.

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

Send data to the given address.

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.

Implementations on Foreign Types§

§

impl DnsUdpSocket for UdpSocket

§

type Time = TokioTime

§

fn poll_recv_from( &self, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<(usize, SocketAddr), Error>>

§

fn poll_send_to( &self, cx: &mut Context<'_>, buf: &[u8], target: SocketAddr, ) -> Poll<Result<usize, Error>>

Implementors§