[][src]Trait romio::raw::AsyncDatagram

pub trait AsyncDatagram {
    type Sender;
    type Receiver;
    type Err;
    fn poll_send_to(
        self: Pin<&mut Self>,
        cx: &mut Context,
        buf: &[u8],
        receiver: &Self::Receiver
    ) -> Poll<Result<usize, Self::Err>>;
fn poll_recv_from(
        self: Pin<&mut Self>,
        cx: &mut Context,
        buf: &mut [u8]
    ) -> Poll<Result<(usize, Self::Sender), Self::Err>>; }

Implement a datagram protocol.

Associated Types

type Sender

Specifies which target to send the data to.

type Receiver

Specifies which target the data was received from.

type Err

The type of failures yielded by this trait.

Loading content...

Required methods

fn poll_send_to(
    self: Pin<&mut Self>,
    cx: &mut Context,
    buf: &[u8],
    receiver: &Self::Receiver
) -> 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(
    self: Pin<&mut Self>,
    cx: &mut Context,
    buf: &mut [u8]
) -> Poll<Result<(usize, Self::Sender), 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

impl AsyncDatagram for UdpSocket[src]

type Sender = SocketAddr

type Receiver = SocketAddr

type Err = Error

impl AsyncDatagram for UnixDatagram[src]

type Sender = SocketAddr

type Receiver = PathBuf

type Err = Error

Loading content...