pub fn intern(s: &str) -> Arc<str>Expand description
Intern a string, returning a reference-counted pointer.
If the string has been interned before, returns the existing Arc<str>.
Otherwise, allocates a new Arc<str> and stores it for future lookups.
§Performance
- First call for a string: O(n) where n is string length (allocation + hash)
- Subsequent calls: O(n) for hash lookup, but no allocation
- Cloning the result: O(1) (just incrementing reference count)
§Examples
use prax_query::intern::intern;
use std::sync::Arc;
let s1 = intern("field_name");
let s2 = intern("field_name");
// Both point to the same allocation
assert!(Arc::ptr_eq(&s1, &s2));