Struct ffi_support::handle_map::HandleMap[][src]

pub struct HandleMap<T> { /* fields omitted */ }
Expand description

HandleMap is a collection type which can hold any type of value, and offers a stable handle which can be used to retrieve it on insertion. These handles offer methods for converting to and from 64 bit integers, meaning they’re very easy to pass over the FFI (they also implement IntoFfi for the same purpose).

See the module level docs for more information.

Note: In FFI code, most usage of HandleMap will be done through the ConcurrentHandleMap type, which is a thin wrapper around a RwLock<HandleMap<Mutex<T>>>.

Implementations

Create a new HandleMap with the default capacity.

Allocate a new HandleMap. Note that the actual capacity may be larger than the requested value.

Panics if request is greater than handle_map::MAX_CAPACITY

Get the number of entries in the HandleMap.

Returns true if the HandleMap is empty.

Returns the number of slots allocated in the handle map.

Insert an item into the map, and return a handle to it.

Delete an item from the HandleMap.

Remove an item from the HandleMap, returning the old value.

Get a reference to the item referenced by the handle, or return a HandleError describing the problem.

Get a mut reference to the item referenced by the handle, or return a HandleError describing the problem.

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

Returns the “default value” for a type. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. 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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.