Skip to main content

bumpalo_intern/
lib.rs

1//! Provides several methods to intern string or string-similar objects.
2//!
3//! This library currently provides two type of string intern mechanism.
4//! One is [`direct::DirectInternStore`], which wraps the Bumpalo allocated `&str` directly.
5//! This allows user to have just a `&str` wrapper which is quite convenient to use.
6//!
7//! The other is [`dense::DenseInternStore`], which gives the densely packed usize wrapper as a tag
8//! (0, 1, 2, ...). This is a bit inconvenient to use as you need to query `DenseInternStore`
9//! what was the original object. Instead, this gives two benefits;
10//!
11//! 1. Tag is always densely packed usize, so you can use Vec<> instead of HashMap<> to have interned object keyed map.
12//! 2. Tag is always usize even if you store much larger object. This is optimal for performance if you want to embed
13//!    interned object in many places.
14//!
15//! See https://github.com/xkikeg/okane for real world examples.
16
17/// Provides [`dense::DenseInternStore`].
18pub mod dense;
19
20/// Provides [`direct::DirectInternStore`].
21pub mod direct;