associated_list

Crates.ioassociated_list
lib.rsassociated_list
version0.2.0
sourcesrc
created_at2024-01-21 17:45:10.906296
updated_at2024-01-28 14:39:10.950798
descriptionAn associated list, for cases when the key implements neither Hash nor Ord.
homepage
repositoryhttps://github.com/spamviech/associated_list
max_upload_size
id1107768
size82,764
(spamviech)

documentation

README

associated_list

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.

PartialEq-only key types

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).

Features

nightly

This feature is a collection, enabling all nightly-only features, requiring unstable features. Currently, this activates the features allocator_api and doc_auto_cfg.

allocator_api

This feature enables the nightly-only feature to use a non-default allocator for the underlying Vec.

doc_auto_cfg

This features enables the nightly-only feature doc_auto_cfg to improve the documentation for types and methods hidden behind feature-flags.

Commit count: 0

cargo fmt