Trait compio_buf::IoBufMut

source ·
pub unsafe trait IoBufMut: IoBuf + SetBufInit {
    // Required method
    fn as_buf_mut_ptr(&mut self) -> *mut u8;

    // Provided method
    fn as_uninit_slice(&mut self) -> &mut [MaybeUninit<u8>] { ... }
}
Expand description

A mutable compio compatible buffer.

The IoBufMut trait is implemented by buffer types that can be passed to compio operations. Users will not need to use this trait directly.

Safety

Buffers passed to compio operations must reference a stable memory region. While the runtime holds ownership to a buffer, the pointer returned by as_buf_mut_ptr must remain valid even if the IoBufMut value is moved.

Required Methods§

source

fn as_buf_mut_ptr(&mut self) -> *mut u8

Returns a raw mutable pointer to the vector’s buffer.

This method is to be used by the compio runtime and it is not expected for users to call it directly.

The implementation must ensure that, while the compio runtime owns the value, the pointer returned does not change.

Provided Methods§

source

fn as_uninit_slice(&mut self) -> &mut [MaybeUninit<u8>]

Get the uninitialized part of the buffer.

Implementations on Foreign Types§

source§

impl IoBufMut for BorrowedBuf<'static>

source§

impl IoBufMut for BytesMut

source§

impl<A: Allocator + Unpin + 'static> IoBufMut for Vec<u8, A>

source§

impl<const N: usize> IoBufMut for ArrayVec<u8, N>

Implementors§