#[repr(C)]
pub struct SmallMap<K, V> { /* private fields */ }
Expand description

An memory-efficient key-value map with determinstic order.

Provides the standard container operations, modelled most closely on IndexMap, plus:

  • Variants which take an already hashed value, e.g. get_hashed.

  • Functions which work with the position, e.g. get_index_of.

Implementations

Empty map.

Create an empty map with specified capacity.

Key references iterator.

Value references iterator.

Mutable value references iterator.

Entry references iterator.

Entry references with hashes iterator.

Entries with hashes iterator.

Mutable entry references iterator.

Entries iterator.

Query the map by a prehashed key.

Query the map by a given key.

Query the map by a given key, return an index of the entry along with the entry key and value.

Find the index of the given hashed key.

Find an entry by an index.

The an entry index by a given key.

Find a mutable value by a hashed key.

Find the entry by a given key.

Find if an entry by a given prehashed key exists.

Find if an entry by a given key exists.

Reserve capacity for at least additional more elements to be inserted.

Current map capacity.

Insert a key-value pair into the map.

Insert a key-value pair into the map.

Remove the entry for the key.

This operation is linear in the number of entries in the map.

source

pub fn remove_hashed_entry<Q>(
    &mut self,
    key: BorrowHashed<'_, Q>
) -> Option<(K, V)> where
    Q: ?Sized + Equivalent<K>,
    K: Eq

Remove the entry for the key.

This operation is linear in the number of entries in the map.

Remove the entry for the key.

source

pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)> where
    Q: ?Sized + Hash + Equivalent<K>,
    K: Eq

Remove the entry for the key.

Get the entry (occupied or not) for the key.

Remove the last element.

Get the entry (occupied or not) for the key.

Is the map empty?

Get the number of elements in the map.

Remove all elements from the map.

Retain the capacity.

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

When type is frozen, it is frozen into this type.

Freeze a value. The frozen value must be equal to the original, and produce the same hash. Read more

Creates a value from an iterator. Read more

Creates a value from an iterator. Read more

The hash of a map is the sum of hashes of all its elements, so that we guarantee equal hash means equals

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Recursively “trace” the value. Read more

Description of values acceptable by unpack_value, e. g. list or str.

Given a Value, try and unpack it into the given type, which may involve some element of conversion. The heap argument is usually not required. Read more

Unpack value, but instead of None return error about incorrect argument type.

Unpack value, but instead of None return error about incorrect named argument type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Get an ARef pointing at this type.

Try and get an ARef pointing at this type. Returns an Err if the type Self is a RefCell which is already mutably borrowed. Read more

Return the underlying RefCell if Self is one, otherwise None.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert between two equal types.

Convert between references to two equal types.

Convert between mutable references to two equal types.

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.