Skip to main content

ConnectedDatagrams

Trait ConnectedDatagrams 

pub trait ConnectedDatagrams:
    Debug
    + Send
    + Sync
    + 'static {
    type Sender: ConnectedDatagramSender;

    // Required methods
    fn payload_sender(&self) -> Self::Sender;
    fn poll_recv(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<Bytes, DatagramError>>;
    fn capabilities(&self) -> DatagramCapabilities;

    // Provided method
    fn recv_payload(
        &mut self,
    ) -> impl Future<Output = Result<Bytes, DatagramError>> + Send
       where Self: Sized { ... }
}
Available on crate features std and udp only.
Expand description

An established datagram association. Its transport selects the destination. Receives yield one complete datagram, including an empty one, or an error.

Required Associated Types§

Required Methods§

fn payload_sender(&self) -> Self::Sender

fn poll_recv( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Bytes, DatagramError>>

fn capabilities(&self) -> DatagramCapabilities

Provided Methods§

fn recv_payload( &mut self, ) -> impl Future<Output = Result<Bytes, DatagramError>> + Send
where Self: Sized,

Receive the next complete payload. Cancelling leaves the next message available.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§