pub unsafe trait IoBuf: Send + 'static {
// Required methods
fn as_ptr(&self) -> *const u8;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
A buffer that can be used for io_uring write operations.
§Safety
Implementors must guarantee that:
- The pointer returned by
as_ptr()remains valid and at a stable address until the I/O operation completes, even ifselfis moved. - This is automatically satisfied for heap-allocated buffers (
Vec<u8>,Box<[u8]>, etc.) but NOT for stack-allocated arrays.