pub struct GuestMemoryAtomic<M: GuestMemory> { /* private fields */ }
Expand description

A fast implementation of a mutable collection of memory regions.

This implementation uses ArcSwap to provide RCU-like snapshotting of the memory map: every update of the memory map creates a completely new GuestMemory object, and readers will not be blocked because the copies they retrieved will be collected once no one can access them anymore. Under the assumption that updates to the memory map are rare, this allows a very efficient implementation of the memory() method.

Implementations

create a new GuestMemoryAtomic object whose initial contents come from the map GuestMemory.

Acquires the update mutex for the GuestMemoryAtomic, blocking the current thread until it is able to do so. The returned RAII guard allows for scoped unlock of the mutex (that is, the mutex will be unlocked when the guard goes out of scope), and optionally also for replacing the contents of the GuestMemoryAtomic when the lock is dropped.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

create a new GuestMemoryAtomic object whose initial contents come from the map reference counted GuestMemory.

A type that provides access to the memory.

The type that will be used to access guest memory.

Return an object (e.g. a reference or guard) that can be used to access memory through this address space. The object provides a consistent snapshot of the memory map. 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.