pub struct TypeMap<A: ?Sized = dyn UnsafeAny> where
    A: UnsafeAnyExt
{ /* private fields */ }
Expand description

A map keyed by types.

Can contain one value of any type for each key type, as defined by the Assoc trait.

You usually do not need to worry about the A type parameter, but it can be used to add bounds to the possible value types that can be stored in this map. Usually, you are looking for ShareMap, which is Send + Sync.

Implementations

Create a new, empty TypeMap.

Create a new, empty TypeMap.

Can be used with any A parameter; new is specialized to get around the required type annotations when using this function.

Insert a value into the map with a specified key type.

Find a value in the map and get a reference to it.

Find a value in the map and get a mutable reference to it.

Check if a key has an associated value stored in the map.

Remove a value from the map.

Returns true if a value was removed.

Get the given key’s corresponding entry in the map for in-place manipulation.

Read the underlying HashMap

Get a mutable reference to the underlying HashMap

Get the number of values stored in the map.

Return true if the map contains no values.

Remove all entries from the map.

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

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

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

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.