XIO

xArchive

Stored page text, served from the archive.

LiteMap — data structures in Rust // Lib.rs

Archived: 2026-11-09 02:41:25 UTC View live page ↗
https://lib.rs/crates/litemap

Stored text only -- layout, images, and scripts from the original page are not preserved.

Lib .rs › Data structures # vec # sorting # vec-map # memory-efficiency no-std litemap A key-value Map implementation based on a flat, sorted Vec by Shane F. Carr , Manish Goregaokar , unicode-org and 3 contributors Audit Install API reference GitHub repo ( unicode-org ) Home (icu4x.unicode.org) 20 releases 0.8.3 Aug 13, 2026 0.8.2 Apr 1, 2026 0.8.1 Oct 28, 2025 0.8.0 May 7, 2025 0.1.1 Mar 4, 2021 # 27 in Data structures 105,681,494 downloads per month Used in 88,411 crates (33 directly) Unicode-3.0 145KB 2.5K SLoC litemap litemap litemap is a crate providing LiteMap , a highly simplistic "flat" key-value map based off of a single sorted vector. The main goal of this crate is to provide a map that is good enough for small sizes, and does not carry the binary size impact of HashMap or BTreeMap . If binary size is not a concern, std :: collections :: BTreeMap may be a better choice for your use case.

It behaves very similarly to LiteMap for less than 12 elements, and upgrades itself gracefully for larger inputs. Performance characteristics LiteMap is a data structure with similar characteristics as std :: collections :: BTreeMap but with slightly different trade-offs as it's implemented on top of a flat storage (e.g. Vec). LiteMap iteration is generally faster than BTreeMap because of the flat storage.

LiteMap can be pre-allocated whereas BTreeMap can't. LiteMap has a smaller memory footprint than BTreeMap for small collections (< 20 items). Lookup is O ( log ( n ) ) like BTreeMap . Insertion is generally O ( n ) , but optimized to O ( 1 ) if the new item sorts greater than the current items.

In BTreeMap it's O ( log ( n ) ) . Deletion is O ( n ) whereas BTreeMap is O ( log ( n ) ) . Bulk operations like from_iter , extend and deserialization have an optimized O ( n ) path for inputs that are ordered and O ( n * log ( n ) ) complexity otherwise. Pluggable Backends By default, LiteMap is backed by a Vec ; however, it can be backed by any appropriate random-access data store, giving that data store a map-like interface.

See the store module for more details. Const construction LiteMap supports const construction from any store that is const-constructible, such as a static slice, via [ LiteMap :: from_sorted_store_unchecked ( ) ]. This also makes LiteMap suitable for use with databake . See impl Bake for LiteMap for more details.

More Information For more information on development, authorship, contributing etc. please visit ICU4X home page . Dependencies ~175KB optional databake serde? serde_ core + alloc optional yoke + derive dev bincode dev criterion 0.5 not wasm32 dev postcard + use-std dev rand 0.9 dev rkyv 0.7 + validation dev serde_ json Other features alloc testing Related: icu_locale_core , icu_normalizer_data , icu_properties_data , writeable , icu_provider , zerofrom-derive , potential_utf , icu_collections , tinystr , icu_normalizer , icu_properties , zerotrie , zerofrom , yoke , zerovec See also: vec_map , vecset , vector-map , sorted-vec , smallbitvec Lib.rs is an unofficial list of Rust/Cargo crates, created by kornelski .

It contains data from multiple sources, including heuristics, and manually curated data . Content of this page is not necessarily endorsed by the authors of the crate. This site is not affiliated with nor endorsed by the Rust Project. If something is missing or incorrect, please file a bug .