pub struct MonoHashMap<K: Hash + Eq, V>(RefCell<FxHashMap<K, Box<V>>>);

Tuple Fields

0: RefCell<FxHashMap<K, Box<V>>>

Implementations

This function exists for priroda to be able to iterate over all evaluator memory.

The function is somewhat roundabout with the closure argument because internally the MonoHashMap uses a RefCell. When iterating over the FxHashMap inside the RefCell, we need to keep a borrow to the FxHashMap inside the iterator. The borrow is only alive as long as the Ref returned by RefCell::borrow() is alive. So we can’t return the iterator, as that would drop the Ref. We can’t return both, as it’s not possible in Rust to have a struct/tuple with a field that refers to another field.

Trait Implementations

The most interesting method: Providing a shared reference without holding the RefCell open, and inserting new data if the key is not used yet. vacant is called if the key is not found in the map; if it returns a reference, that is used directly, if it returns owned data, that is put into the map and returned.

Read-only lookup (avoid read-acquiring the RefCell).

Tests if the map contains the given key. Deliberately takes &mut because that is sufficient, and some implementations can be more efficient then (using RefCell::get_mut). Read more

Inserts a new entry into the map.

Removes an entry from the map.

Returns data based on the keys and values in the map.

Returns a mutable reference to entry k. If no such entry exists, call vacant and either forward its error, or add its result to the map and return a reference to that. Read more

Mutable lookup.

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

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.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes