Skip to main content

IoBufMut

Trait IoBufMut 

Source
pub unsafe trait IoBufMut: IoBuf {
    // Required methods
    fn stable_mut_ptr(&mut self) -> *mut u8;
    unsafe fn set_init(&mut self, pos: usize);
}
Expand description

A buffer an owned read fills: an IoBuf whose memory past the bytes it holds may be written, and told how many hold data after a read.

§Safety

As IoBuf; and stable_mut_ptr points at the same memory, writable for all bytes_total bytes.

Required Methods§

Source

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

The address of the buffer’s first byte, for writing.

Source

unsafe fn set_init(&mut self, pos: usize)

Sets how many bytes from the start hold data to pos (the runtime calls it with a smaller count too, never below what the caller handed in).

§Safety

pos <= bytes_total(), and the first pos bytes are initialized.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IoBufMut for Vec<u8>

Source§

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

Source§

unsafe fn set_init(&mut self, pos: usize)

Implementors§