Crates.io | indexmap-nostd |
lib.rs | indexmap-nostd |
version | 0.4.0 |
source | src |
created_at | 2022-08-24 14:45:53.258993 |
updated_at | 2022-08-25 15:22:24.865204 |
description | A no_std compatible implementation of the indexmap crate |
homepage | |
repository | https://github.com/robbepop/indexmap-nostd |
max_upload_size | |
id | 651660 |
size | 63,383 |
indexmap-nostd
A no_std
compatible indexmap
crate (re)implementation.
Note: The indexmap
crate already supports to be compiled in
no_std
environments and it uses hashbrown
crate's HashMap
under the
hood which still requires some sort of randomized initialization.
However, some embedded platforms simply cannot provide ways to randomly
seed hash maps and similar data structures making code that depends on it
susceptible to users (or attackers) that control inputs to those hash maps.
Therefore indexmap-nostd
is a (re)implementation of the indexmap
crate
that replaces the internal use of HashMap
with BTreeMap
.
This crate and its data structures can be used in any embedded no_std
environment without the need to provide random seeds for HashMap
initialization.
indexmap-nostd
focuses on being easy to
maintain simple code which trades off efficiency compared to the original
indexmap
crate.
An example of performance regression is that now inserted keys are duplicated.IndexMap::insert
now requires K: Clone
.no_std
compatible implementation
to be working for the wasmparser
crate. This means that we primarily
provide a subset of the features and API of the original indexmap
crate
and might not be interested in adding features that we do not need for
this use case that are also hard to implement or maintain.