pub trait PollWaitExt<const t: _Direction> {
// Required method
fn poll_wait(&self, _timeout: Option<Duration>) -> Result<(), Error>;
}
Expand description
A trait for polling XDP sockets for readiness events.
This trait provides the poll_wait
method, which blocks until the socket’s file
descriptor becomes ready for I/O. The readiness event depends on the socket direction:
- For transmit sockets (
_TX
), it waits for the socket to be writable (POLLOUT
). - For receive sockets (
_RX
), it waits for the socket to be readable (POLLIN
).
§Type Parameters
t
- The direction of the socket (_TX
or_RX
).
§Example
use xdp_socket::{ create_socket, PollWaitExt as _ } ;
let socket = ...; // your Socket<_TX> or Socket<_RX>
socket.poll_wait(Some(std::time::Duration::from_secs(1)))?;