chisel_stringtable/lib.rs
1//! ## Overview
2//!
3//! This crate contains a very simple string table which can be used to *intern* strings by
4//! stashing them all within a single data-structure, and then referencing them throughout other
5//! areas of a code base using a unique `u64` identifier.
6//!
7//! Currently there is a single implementation of an interning data structure based on an internal
8//! B-Tree index. Nothing very sophisticated going on here at all.
9//!
10//! ### Usage
11//!
12//! There really isn't much to it:
13//!
14//! ```rust
15//! use chisel_stringtable::btree_string_table::BTreeStringTable;
16//! use chisel_stringtable::common::StringTable;
17//!
18//! let mut table = BTreeStringTable::new();
19//! let key : u64 = table.add("some value to intern");
20//! assert_eq!(table.get(key).unwrap(), "some value to intern");
21//! assert_eq!(format!("Here's me embedded string: {}", table.get(key).unwrap()),
22//! "Here's me embedded string: some value to intern")
23//! ```
24pub mod btree_string_table;
25pub mod common;