pub enum IMap<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'static> {
    Static(&'static [(K, V)]),
    Rc(Rc<Map<K, V>>),
    Empty,
}
This is supported on crate feature map only.
Expand description

An immutable hash map type inspired by Immutable.js.

This type is cheap to clone and thus implements ImplicitClone. It can be created based on a &'static [(K, V)], or based on a reference counted IndexMap.

This type has the least stable API at the moment and is subject to change a lot before the 1.0 release.

Variants

Static(&'static [(K, V)])

A (small) static map.

Rc(Rc<Map<K, V>>)

An reference counted map.

Empty

An empty map.

Implementations

Return an iterator over the key-value pairs of the map, in their order.

Return an iterator over the keys of the map, in their order.

Return an iterator over the values of the map, in their order.

Return the number of key-value pairs in the map.

Computes in O(1) time.

Returns true if the map contains no elements.

Computes in O(1) time.

Return a clone to the value stored for key, if it is present, else None.

Computes in O(1) time (average).

Return clones to the key-value pair stored for key, if it is present, else None.

Computes in O(1) time (average).

Return item index, key and value

Get a key-value pair by index.

Valid indices are 0 <= index < self.len()

Computes in O(1) time.

Return item index, if it exists in the map.

Computes in O(1) time (average).

Return true if an equivalent to key exists in the map.

Computes in O(1) time (average).

Get the last key-value pair.

Computes in O(1) time.

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.