Function ustr_fxhash::existing_ustr
source · pub fn existing_ustr(s: &str) -> Option<Ustr>
Expand description
Create a new Ustr from the given &str but only if it already exists in the string cache.
use ustr_fxhash::{ustr, existing_ustr};
let u1 = existing_ustr("the quick brown fox");
let u2 = ustr("the quick brown fox");
let u3 = existing_ustr("the quick brown fox");
assert_eq!(u1, None);
assert_eq!(u3, Some(u2));