| 1 |
//! Type definitions for maps and sets used by the `wasmparser` crate. |
| 2 |
//! |
| 3 |
//! This module contains type definitions for [`Map`], [`Set`], [`IndexMap`], and [`IndexSet`]. |
| 4 |
//! These types are thin-wrappers around either hash-map based or B-tree-map based data structures. |
| 5 |
//! Users can strictly use the `btree`-map based variants by enabling the `no-hash-maps` crate feature. |
| 6 |
//! |
| 7 |
//! - [`Map`]: Either backed by [`hashbrown::HashMap`] or Rust's [`BTreeMap`]. |
| 8 |
//! - [`Set`]: Either backed by [`hashbrown::HashSet`] or Rust's [`BTreeSet`]. |
| 9 |
//! - [`IndexMap`]: Either backed by [`indexmap::IndexMap`] or a custom implementation based on Rust's [`BTreeMap`]. |
| 10 |
//! - [`IndexSet`]: Either backed by [`indexmap::IndexSet`] or a custom implementation based on Rust's [`BTreeMap`]. |
| 11 |
//! |
| 12 |
//! For the hash-map based type definitions the hash algorithm type parameter is fixed. |
| 13 |
//! |
| 14 |
//! [`BTreeMap`]: alloc::collections::BTreeMap |
| 15 |
//! [`BTreeSet`]: alloc::collections::BTreeSet |
| 16 |
|
| 17 |
// Which collections will be used feature matrix: |
| 18 |
// |
| 19 |
// `hash-collections` | `prefer-btree-collections` | usage |
| 20 |
// ------------------ | -------------------------- | ------------------- |
| 21 |
// false | false | btree |
| 22 |
// true | false | hash |
| 23 |
// false | true | btree |
| 24 |
// true | true | btree |
| 25 |
|
| 26 |
#[cfg(feature = "hash-collections")] |
| 27 |
pub mod hash; |
| 28 |
pub mod index_map; |
| 29 |
pub mod index_set; |
| 30 |
pub mod map; |
| 31 |
pub mod set; |
| 32 |
|
| 33 |
#[doc(inline)] |
| 34 |
pub use self::{index_map::IndexMap, index_set::IndexSet, map::Map, set::Set}; |