Crates.io | associated_list |
lib.rs | associated_list |
version | 0.2.0 |
source | src |
created_at | 2024-01-21 17:45:10.906296 |
updated_at | 2024-01-28 14:39:10.950798 |
description | An associated list, for cases when the key implements neither Hash nor Ord. |
homepage | |
repository | https://github.com/spamviech/associated_list |
max_upload_size | |
id | 1107768 |
size | 82,764 |
An associated list based on a Vec
, providing the usual map functionality.
The methods are purely based on the PartialEq
implementation of the key types,
so most have a runtime characteristic of O(n)
.
In general, you should prefer to use either a HashMap
, or a BTreeMap
.
The AssocList
exists as a fallback if the key implements neither Hash
nor Ord
.
The crate is #![no_std]
-compatible, but requires alloc
.
All methods only require PartialEq
for the key, but there is a strong argument to only use key types
that are also (at least nearly) Ord
. For example, elements associated with a f32::NAN
cannot be found or deleted (PartialEq::eq
will alway return false
).
This feature is a collection, enabling all nightly-only features, requiring unstable features.
Currently, this activates the features allocator_api
and doc_auto_cfg
.
This feature enables the nightly-only feature to use a non-default allocator for the underlying Vec
.
This features enables the nightly-only feature doc_auto_cfg
to improve the documentation
for types and methods hidden behind feature-flags.