[][src]Trait async_datagram::AsyncDatagram

pub trait AsyncDatagram {
    type Target;
    type Err;
    fn poll_send_to(
        &mut self,
        waker: &Waker,
        buf: &[u8],
        target: impl AsRef<Self::Target>
    ) -> Poll<Result<usize, Self::Err>>;
fn poll_recv_from(
        &mut self,
        waker: &Waker,
        buf: &mut [u8]
    ) -> Poll<Result<(usize, Self::Target), Self::Err>>; }

Implement a datagram protocol.

Associated Types

type Target

Specifies which target to send the data to.

type Err

The type of failures yielded by this trait.

Loading content...

Required methods

fn poll_send_to(
    &mut self,
    waker: &Waker,
    buf: &[u8],
    target: impl AsRef<Self::Target>
) -> Poll<Result<usize, Self::Err>>

Sends data on the IO interface to the specified target.

On success, returns the number of bytes written.

fn poll_recv_from(
    &mut self,
    waker: &Waker,
    buf: &mut [u8]
) -> Poll<Result<(usize, Self::Target), Self::Err>>

Receives data from the IO interface.

On success, returns the number of bytes read and the target from whence the data came.

Loading content...

Implementors

Loading content...