pub trait InternExt: AsRef<str> {
// Provided method
fn intern(&self) -> InternedStr { ... }
}Available on crate feature
global only.Expand description
An “extension trait” to add a the intern method to str,
which effectively adds it to all types that directly or transitively implement Deref<Target = str>,
which includes String, references, and smart pointers to str or String.
Ideally, I would like to ban Rc, but that would require auto traits or negative impls or something.
My reasoning for this is that I suspect it will be a bit of a footgun,
or at least an unintuitive behavior if Rc becomes an Arc when it gets interned.
Provided Methods§
Sourcefn intern(&self) -> InternedStr
fn intern(&self) -> InternedStr
Equivalent to intern(self).
See intern.