Struct data_model::iobuf::IoBufMut

source ·
#[repr(transparent)]
pub struct IoBufMut<'a> { iobuf: IoBuf, phantom: PhantomData<&'a mut [u8]>, }
Expand description

Cross-platform mutable buffer.

This type is essentialy std::io::IoSliceMut, and guaranteed to be ABI-compatible with libc::iovec on Linux/WSABUF on Windows; however, it does NOT automatically deref to &mut [u8], which is critical because it can point to guest memory. (Guest memory is implicitly mutably borrowed by the guest, so another mutable borrow would violate Rust assumptions about references.)

Fields§

§iobuf: IoBuf§phantom: PhantomData<&'a mut [u8]>

Implementations§

Creates a IoBufMut from a pointer and a length.

Safety

In order to use this method safely, addr must be valid for reads and writes of len bytes and should live for the entire duration of lifetime 'a.

Creates a IoBufMut from an IoBuf.

Safety

In order to use this method safely, iobuf must be valid for reads and writes through its length and should live for the entire duration of lifetime 'a.

Advance the internal position of the buffer.

Panics if count > self.len().

Shorten the length of the buffer.

Has no effect if len > self.len().

Gets a const pointer to this slice’s memory.

Gets a mutable pointer to this slice’s memory.

Converts a slice of IoBufMuts into a slice of IoBufs.

Trait Implementations§

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.