Trait compio_buf::IoBufMut

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

    // Provided methods
    fn as_mut_slice(&mut self) -> &mut [MaybeUninit<u8>] { ... }
    unsafe fn as_io_slice_mut(&mut self) -> IoSliceMut { ... }
}
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.

Provided Methods§

source

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

Get the uninitialized part of the buffer.

source

unsafe fn as_io_slice_mut(&mut self) -> IoSliceMut

Create an IoSliceMut of the uninitialized part of the buffer.

§Safety

The return slice will not live longer than self. It is static to provide convenience from writing self-referenced structure.

Implementations on Foreign Types§

source§

impl IoBufMut for BorrowedBuf<'static>

Available on crate feature read_buf only.
source§

impl IoBufMut for BytesMut

Available on crate feature bytes only.
source§

impl IoBufMut for [u8]

source§

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

source§

impl<B: IoBufMut + ?Sized> IoBufMut for &'static mut B

source§

impl<B: IoBufMut + ?Sized, A: Allocator + 'static> IoBufMut for Box<B, A>

source§

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

Available on crate feature arrayvec only.
source§

impl<const N: usize> IoBufMut for [u8; N]

Implementors§

source§

impl<T> IoBufMut for IndexedIter<T>
where T: IndexableMut + 'static, T::Output: IoBufMut,

source§

impl<T: IoBufMut> IoBufMut for Slice<T>