IoBuf

Trait IoBuf 

Source
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 if self is moved.
  • This is automatically satisfied for heap-allocated buffers (Vec<u8>, Box<[u8]>, etc.) but NOT for stack-allocated arrays.

Required Methods§

Source

fn as_ptr(&self) -> *const u8

Returns a pointer to the buffer’s data.

Source

fn len(&self) -> usize

Returns the number of initialized bytes in the buffer.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the buffer is empty.

Implementations on Foreign Types§

Source§

impl IoBuf for Box<[u8]>

Source§

fn as_ptr(&self) -> *const u8

Source§

fn len(&self) -> usize

Source§

impl IoBuf for Vec<u8>

Source§

fn as_ptr(&self) -> *const u8

Source§

fn len(&self) -> usize

Implementors§