pub struct UserMem { /* private fields */ }
Expand description

Wrapper to safely allocate memory for guest VMs.

The underlying memory is freed automatically once the UserMem instance is dropped.

Memory can be mapped into a guest VM with Vm::set_user_memory_region.

Implementations

Allocate a zero-initialized memory region of len bytes.

Allocate a zero-initialized memory region of len bytes and initialize the first bytes with init_from.

Panics

Panics if init_from is larger than the memory size len.

Load the bytes stored in data into memory at physical address addr.

Panics

Panics if addr + data.len is larger than the memory size len.

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.

Free underlying memory.

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 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.