pub trait Intern {
// Required method
fn intern(self) -> IString
where Self: Sized;
}
Required Methods§
Implementations on Foreign Types§
Source§impl Intern for &str
impl Intern for &str
Source§fn intern(self) -> IString
fn intern(self) -> IString
Intern the given &str
by cloning its contents.
This operation runs in O(N) where N is the string.len()
.
If the string was already interned, this operation is lock-free.
Otherwise, a global lock is acquired.
§Example
use interned_string::Intern;
let my_istring = "hello".intern();
Source§impl Intern for String
impl Intern for String
Source§fn intern(self) -> IString
fn intern(self) -> IString
Intern the given String
by consuming it. Its allocation is reused.
This operation runs in O(N) where N is the string.len()
.
If the string was already interned, this operation is lock-free.
Otherwise, a global lock is acquired.
§Example
use interned_string::Intern;
let my_istring = "hello".to_string().intern();