AbstractUdpSocket

Trait AbstractUdpSocket 

Source
pub trait AbstractUdpSocket: Send + Sync {
    // Required methods
    fn create_io_poller(self: Arc<Self>) -> Pin<Box<dyn UdpPoller>>;
    fn try_send(&self, transmit: &Transmit<'_>) -> IoResult<()>;
    fn poll_recv(
        &self,
        cx: &mut Context<'_>,
        bufs: &mut [IoSliceMut<'_>],
        meta: &mut [RecvMeta],
    ) -> Poll<IoResult<usize>>;
    fn local_addr(&self) -> IoResult<SocketAddr>;

    // Provided methods
    fn max_transmit_segments(&self) -> usize { ... }
    fn max_receive_segments(&self) -> usize { ... }
    fn may_fragment(&self) -> bool { ... }
    fn recv(
        &self,
        bufs: &mut [IoSliceMut<'_>],
        meta: &mut [RecvMeta],
    ) -> impl Future<Output = IoResult<usize>> + Send { ... }
    fn poll_send(
        &self,
        _cx: &mut Context<'_>,
        buf: &[u8],
        target: SocketAddr,
    ) -> Poll<IoResult<usize>> { ... }
    fn send<'a>(
        &'a self,
        buf: &'a [u8],
        target: SocketAddr,
    ) -> impl Future<Output = IoResult<usize>> + Send + 'a { ... }
}

Required Methods§

Source

fn create_io_poller(self: Arc<Self>) -> Pin<Box<dyn UdpPoller>>

Required methods Creates a UDP socket I/O poller.

Source

fn try_send(&self, transmit: &Transmit<'_>) -> IoResult<()>

Tries to send a UDP datagram to the specified destination.

Source

fn poll_recv( &self, cx: &mut Context<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta], ) -> Poll<IoResult<usize>>

Poll to receive a UDP datagram.

Source

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

Returns the local socket address.

Provided Methods§

Source

fn max_transmit_segments(&self) -> usize

Maximum number of segments that can be transmitted in one call.

Source

fn max_receive_segments(&self) -> usize

Maximum number of segments that can be received in one call.

Source

fn may_fragment(&self) -> bool

Returns whether the socket may fragment packets.

Source

fn recv( &self, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta], ) -> impl Future<Output = IoResult<usize>> + Send

Supplied methods Receive a UDP datagram. meta is the returned metadata for each buffer in bufs.

Source

fn poll_send( &self, _cx: &mut Context<'_>, buf: &[u8], target: SocketAddr, ) -> Poll<IoResult<usize>>

Sends data on the socket to the given address.

Source

fn send<'a>( &'a self, buf: &'a [u8], target: SocketAddr, ) -> impl Future<Output = IoResult<usize>> + Send + 'a

Sends data on the socket 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.

Implementors§