# detain
Fast, simple string interner.
## Usage
```rust
use detain::Interner;
let mut interner = Interner::new();
let hello = interner.intern("hello");
let world = interner.intern("world");
let hello2 = interner.intern("hello");
assert_eq!(hello, hello2);
assert_eq!(interner.resolve(hello), "hello");
```
## Features
- **Compact**: `Symbol` is 4 bytes
- **Fast**: FxHash + optimized for 110 common IPC-2581 identifiers
- **Simple**: Single growing arena, immutable, ~120 LOC
## Customizing
Edit `COMMON` in `src/lib.rs` to add your frequently-used strings:
```rust
static COMMON: phf::Map<&'static str, u32> = phf_map! {
"x" => 0, "y" => 1, "your_identifier" => 2, // sequential indices
};
```
## Testing
```bash
# Unit tests
cargo test
# Property-based tests (100 cases per test by default)
cargo test proptests
# Fuzz testing
cargo +nightly fuzz run fuzz_interner -- -runs=10000
cargo +nightly fuzz run fuzz_common -- -runs=10000
# Miri (detects undefined behavior, proptests auto-skipped)
cargo +nightly miri test
```
## License
0BSD