pub trait UdpPoller:
Send
+ Sync
+ Debug
+ 'static {
// Required method
fn poll_writable(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<()>>;
}展开描述
通过轮询检测关联的 AsyncUdpSocket 是否可写
单个 AsyncUdpSocket 可以存在任意数量的 UdpPoller。每个 UdpPoller 负责在该套接字可写时通知至多一个任务。
必需方法§
源代码fn poll_writable(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_writable(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
检查相关套接字是否可能可写
必须在 AsyncUdpSocket::try_send 返回 io::ErrorKind::WouldBlock 之后调用,
以便将 cx 关联的任务注册为在下次可发送时唤醒。与 Future::poll 不同,UdpPoller 可以无限次复用,
无论 poll_writable 返回多少次 Poll::Ready。