feat(tazjin/rlox): Add a simple string interner
This is based on this matklad post: https://matklad.github.io/2020/03/22/fast-simple-rust-interner.html It's modified slightly to provide a safer interface and slightly more readable implementation: * interned string IDs are wrapped in a newtype that is not publicly constructible * unsafe block is reduced to only the small scope in which it is needed * lookup lifetime is pinned explicitly to make the intent clearer when reading this code Change-Id: Ia3dae988f33f8e5e7d8dc0c1a9216914a945b036 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2578 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
6f600c8300
commit
ef7a0da8cb
3 changed files with 112 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
mod chunk;
|
||||
mod compiler;
|
||||
mod errors;
|
||||
mod interner;
|
||||
mod opcode;
|
||||
mod value;
|
||||
mod vm;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue