2 releases

Uses new Rust 2024

0.1.1 Apr 14, 2025
0.1.0 Apr 13, 2025

#2 in #non-zero-usize


Used in 2 crates

Zlib OR Apache-2.0 OR MIT

7KB
130 lines

str_id

Interns str slices into ID values


lib.rs:

Interns str slices, giving you back an ID value.

The ID value is a newtyped [NonZeroUsize]. You get approximately the same benefits as using Box<Str>, but when the same str is used in multiple locations they'll resolve to the same ID value.

All str slice data resides in a global cache. There is no way to purge the cache once a str slice has been interned. This library is not intended for long running programs.

Dependencies

~115KB