musli_zerocopy/swiss/mod.rs
1//! A ZeroCopy [`Map`] and [`Set`] based on Google's [SwissTable] algorithm.
2//!
3//! While this results in slower map representation than [`phf`], it is more
4//! suitable for large data sets.
5//!
6//! This implementation is derived from the [`hashbrown` crate], but has been
7//! modified to:
8//! * Write directly into a pre-allocated buffer rather that allocate
9//! internally.
10//! * Tolerate unexpected representations. Since a loaded variant of this table
11//! can tolerate most byte representations we need to ensure that the table at
12//! most errors and don't end up exhibiting some under-specified behavior like
13//! looping forever on lookups.
14//!
15//! [`phf`]: crate::phf
16//! [SwissTable]: <https://abseil.io/about/design/swisstables>
17//! [`hashbrown` crate]: https://crates.io/crates/hashbrown
18
19/// Map internals copied from hashbrown under the Apache 2.0 OR MIT license.
20///
21/// Copyright (c) 2016 Amanieu d'Antras
22///
23/// See:
24/// <https://github.com/rust-lang/hashbrown/tree/3d2d1638d90053cb7d6a96090bc7c2bd2fd10d71>.
25mod raw;
26
27pub(crate) use self::entry::Entry;
28mod entry;
29
30#[doc(inline)]
31pub use self::map::{Map, MapRef};
32pub mod map;
33
34#[doc(inline)]
35pub use self::set::{Set, SetRef};
36pub mod set;
37
38#[cfg(feature = "alloc")]
39mod constructor;
40
41#[cfg(feature = "alloc")]
42#[doc(inline)]
43pub use self::factory::*;
44#[cfg(feature = "alloc")]
45mod factory;