pub trait DataPlaneIo {
// Required methods
fn backend(&self) -> Backend;
fn send(&mut self, datagram: &[u8]) -> Result<()>;
fn recv(&mut self, buf: &mut [u8]) -> Result<usize>;
// Provided methods
fn send_batch(&mut self, datagrams: &[&[u8]]) -> Result<usize> { ... }
fn recv_batch(
&mut self,
bufs: &mut [[u8; 2048]],
lens: &mut [usize],
) -> Result<usize> { ... }
}Expand description
Sends and receives wire datagrams via the selected backend. Implemented in M4.
Required Methods§
Provided Methods§
Sourcefn send_batch(&mut self, datagrams: &[&[u8]]) -> Result<usize>
fn send_batch(&mut self, datagrams: &[&[u8]]) -> Result<usize>
Send up to datagrams.len() datagrams in one syscall where supported.
Returns the number of datagrams actually sent. The default implementation
loops over DataPlaneIo::send; override for real batching (e.g. sendmmsg).
Sourcefn recv_batch(
&mut self,
bufs: &mut [[u8; 2048]],
lens: &mut [usize],
) -> Result<usize>
fn recv_batch( &mut self, bufs: &mut [[u8; 2048]], lens: &mut [usize], ) -> Result<usize>
Receive up to bufs.len() datagrams in one syscall where supported.
Fills lens[i] with the byte count of the i-th received datagram and
returns the number of datagrams received. The default implementation does
a single DataPlaneIo::recv; override for real batching (e.g. recvmmsg).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".