1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5//! # `litemap`
6//!
7//! `litemap` is a crate providing [`LiteMap`], a highly simplistic "flat" key-value map
8//! based off of a single sorted vector.
9//!
10//! The goal of this crate is to provide a map that is good enough for small
11//! sizes, and does not carry the binary size impact of [`HashMap`](std::collections::HashMap)
12//! or [`BTreeMap`](alloc::collections::BTreeMap).
13//!
14//! If binary size is not a concern, [`std::collections::BTreeMap`] may be a better choice
15//! for your use case. It behaves very similarly to [`LiteMap`] for less than 12 elements,
16//! and upgrades itself gracefully for larger inputs.
17//!
18//! ## Pluggable Backends
19//!
20//! By default, [`LiteMap`] is backed by a [`Vec`]; however, it can be backed by any appropriate
21//! random-access data store, giving that data store a map-like interface. See the [`store`]
22//! module for more details.
23//!
24//! [`Vec`]: alloc::vec::Vec
25
26// https://github.com/unicode-org/icu4x/blob/main/docs/process/boilerplate.md#library-annotations
27#![cfg_attr(not(test), no_std)]
28#![cfg_attr(
29 not(test),
30 deny(
31 clippy::indexing_slicing,
32 clippy::unwrap_used,
33 clippy::expect_used,
34 clippy::panic,
35 clippy::exhaustive_structs,
36 clippy::exhaustive_enums,
37 missing_debug_implementations,
38 )
39)]
40
41// for intra doc links
42#[cfg(doc)]
43extern crate std;
44
45extern crate alloc;
46
47mod map;
48#[cfg(feature = "serde")]
49mod serde;
50#[cfg(feature = "serde")]
51mod serde_helpers;
52pub mod store;
53
54#[cfg(any(test, feature = "testing"))]
55pub mod testing;
56
57pub use map::LiteMap;
58