pub trait AsyncUdpSocket<P: ConnectionPeer>: Send + Sync {
// Required methods
fn send_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
peer: &'life2 Peer<P>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn recv_from<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<(usize, Peer<P>)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
An abstract representation of an asynchronous UDP socket.
Required Methods§
Sourcefn send_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
peer: &'life2 Peer<P>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
peer: &'life2 Peer<P>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Attempts to send data on the socket to a given peer. Note that this should return nearly immediately, rather than awaiting something internally.