mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-09 00:00:08 +02:00
udp: UdpSocket split support (#1226)
This commit is contained in:
@@ -11,12 +11,12 @@ use std::task::{Context, Poll};
|
||||
#[must_use = "futures do nothing unless polled"]
|
||||
#[derive(Debug)]
|
||||
pub struct RecvFrom<'a, 'b> {
|
||||
socket: &'a mut UdpSocket,
|
||||
socket: &'a UdpSocket,
|
||||
buf: &'b mut [u8],
|
||||
}
|
||||
|
||||
impl<'a, 'b> RecvFrom<'a, 'b> {
|
||||
pub(super) fn new(socket: &'a mut UdpSocket, buf: &'b mut [u8]) -> Self {
|
||||
pub(super) fn new(socket: &'a UdpSocket, buf: &'b mut [u8]) -> Self {
|
||||
Self { socket, buf }
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,6 @@ impl<'a, 'b> Future for RecvFrom<'a, 'b> {
|
||||
|
||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
let RecvFrom { socket, buf } = self.get_mut();
|
||||
Pin::new(&mut **socket).poll_recv_from(cx, buf)
|
||||
socket.poll_recv_from_priv(cx, buf)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user