[−][src]Trait async_coap::datagram::AsyncRecvFrom
Trait for providing recv_from
functionality for asynchronous, datagram-based sockets.
The value returned on success is a tuple of the following:
(bytes_written: usize, remote_socket_addr: SocketAddr, local_socket_addr: Option<SocketAddr>)
local_socket_addr
indicates the local address that the packet was sent to, and may not be
supported. If this isn't supported, local_socket_addr
will be set to None
.
Required methods
fn poll_recv_from(
self: Pin<&Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
self: Pin<&Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
A non-blocking1, poll_*
version of std::net::UdpSocket::recv_from
that can
optionally provide the destination (local) SocketAddr
.
If you need to receive a packet from within an async block, see
AsyncRecvFrom::next_recv_from
, which returns a Future
.
Note that while the spirit of this method intends for it to be non-blocking,
AllowStdUdpSocket
can in fact block execution depending on the state of the underlyingstd::net::UdpSocket
. ↩
Provided methods
ⓘImportant traits for NextRecvFromFuture<'a, 'b, T>fn next_recv_from<'a, 'b>(
&'a self,
buf: &'b mut [u8]
) -> NextRecvFromFuture<'a, 'b, Self>
&'a self,
buf: &'b mut [u8]
) -> NextRecvFromFuture<'a, 'b, Self>
Returns a future that uses poll_recv_from
.
Implementors
impl AsyncRecvFrom for AllowStdUdpSocket
[src]
fn poll_recv_from(
self: Pin<&Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
[src]
self: Pin<&Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
impl AsyncRecvFrom for LoopbackSocket
[src]
fn poll_recv_from(
self: Pin<&Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
[src]
self: Pin<&Self>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>