Skip to main content

BufferMut

Trait BufferMut 

Source
pub unsafe trait BufferMut: Collection {
    // Required method
    fn as_bytes_mut(&mut self) -> &mut [u8] ;

    // Provided method
    fn scatter_from(&mut self, bytes: &[u8]) { ... }
}
Expand description

A writable, contiguous receive buffer.

§Safety

BufferMut::as_bytes_mut must return exactly count * element_size bytes; writing any bit pattern of that length must leave the buffer in a valid state (guaranteed for Equivalence POD element types).

Required Methods§

Source

fn as_bytes_mut(&mut self) -> &mut [u8]

A mutable byte view of the whole buffer.

Provided Methods§

Source

fn scatter_from(&mut self, bytes: &[u8])

Place received bytes into this buffer.

The default performs a contiguous copy, which is correct for plain buffers. Strided / derived-datatype receive buffers (e.g. MutView) override this to scatter the incoming bytes according to their type map.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Equivalence, const N: usize> BufferMut for [T; N]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<T: Equivalence> BufferMut for [T]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Implementors§