cl-structures: Global (ew!) and local string interning!

- StringArena provides an arena for immutable strings, inspired by other string interners, and keeps track of the ends of every allocated string. Strings inserted into the arena are assigned a Symbol.
- intern::Interner keeps track of the hashes of each inserted string, and provides deduplication for interned strings. This allows referential comparison between interned strings
- global_intern::GlobalSym provides metered access to a Global Interner, and has a Display implementation which queries the Interner.

The global interner is planned for use in cl-ast.

TODO: the unstable raw_entry API is about to be removed from Rust. Maybe switch to hashbrown, or write my own hash table?
This commit is contained in:
2024-04-24 17:11:41 -05:00
parent f24bd10c53
commit e70ffd1895
6 changed files with 308 additions and 1 deletions

View File

@@ -2,9 +2,17 @@
//! - [Span](struct@span::Span): Stores a start and end [Loc](struct@span::Loc)
//! - [Loc](struct@span::Loc): Stores the index in a stream
#![warn(clippy::all)]
#![feature(inline_const, dropck_eyepatch, decl_macro, get_many_mut)]
#![feature(
inline_const,
dropck_eyepatch,
decl_macro,
get_many_mut,
hash_raw_entry
)]
#![deny(unsafe_op_in_unsafe_fn)]
pub mod arena;
pub mod span;
pub mod tree;