#value #string #str-id

str_id

Interns str slices, giving you back an ID value

2 releases

Uses new Rust 2024

new 0.1.1 Apr 14, 2025
0.1.0 Apr 13, 2025

#146 in #value

28 downloads per month
Used in yagbas_asmtypes

Zlib OR Apache-2.0 OR MIT

7KB
125 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

~99KB