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§
Sourcefn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
A mutable byte view of the whole buffer.
Provided Methods§
Sourcefn scatter_from(&mut self, bytes: &[u8])
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".