pub trait UdpSender:
Send
+ Sync
+ Debug
+ 'static {
// Required method
fn poll_send(
self: Pin<&mut Self>,
transmit: &Transmit<'_>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>;
// Provided method
fn max_transmit_segments(&self) -> usize { ... }
}Expand description
An object for asynchronously writing to an associated AsyncUdpSocket.
Any number of UdpSenders may exist for a single AsyncUdpSocket. Each UdpSender is
responsible for notifying at most one task for send readiness.
Required Methods§
Sourcefn poll_send(
self: Pin<&mut Self>,
transmit: &Transmit<'_>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>
fn poll_send( self: Pin<&mut Self>, transmit: &Transmit<'_>, cx: &mut Context<'_>, ) -> Poll<Result<()>>
Send a UDP datagram, or register to be woken if sending may succeed in the future.
Usually implementations of this will poll the socket for writability before trying to write to them, and retry both if writing fails.
Quinn will create multiple UdpSenders, one for each task it’s using it from. Thus it’s
important to poll the underlying socket in a way that doesn’t overwrite wakers.
A single UdpSender will be reused, even if poll_send returns Poll::Ready once,
unlike Future::poll, so calling it again after readiness should not panic.
Provided Methods§
Sourcefn max_transmit_segments(&self) -> usize
fn max_transmit_segments(&self) -> usize
Maximum number of datagrams that a Transmit may encode.