compio_buf

Trait 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 SmallVec<[u8; N]>
where [u8; N]: Array<Item = u8>,

Available on crate feature smallvec 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>