Struct rhai::StringsInterner
source · [−]pub struct StringsInterner<'a> {
pub capacity: usize,
pub max_string_len: usize,
/* private fields */
}
Expand description
(internals) A factory of identifiers from text strings.
Exported under the internals
feature only.
Normal identifiers, property getters and setters are interned separately.
Fields
capacity: usize
Maximum number of strings interned.
max_string_len: usize
Maximum string length.
Implementations
sourceimpl StringsInterner<'_>
impl StringsInterner<'_>
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new StringsInterner
.
sourcepub fn get<S: AsRef<str> + Into<ImmutableString>>(
&mut self,
text: S
) -> ImmutableString
pub fn get<S: AsRef<str> + Into<ImmutableString>>(
&mut self,
text: S
) -> ImmutableString
Get an identifier from a text string, adding it to the interner if necessary.
sourcepub fn get_with_mapper<S: AsRef<str>>(
&mut self,
mapper: fn(_: S) -> ImmutableString,
text: S
) -> ImmutableString
pub fn get_with_mapper<S: AsRef<str>>(
&mut self,
mapper: fn(_: S) -> ImmutableString,
text: S
) -> ImmutableString
Get an identifier from a text string, adding it to the interner if necessary.
Trait Implementations
sourceimpl AddAssign<&StringsInterner<'_>> for StringsInterner<'_>
impl AddAssign<&StringsInterner<'_>> for StringsInterner<'_>
sourcefn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
Performs the +=
operation. Read more
sourceimpl AddAssign<StringsInterner<'_>> for StringsInterner<'_>
impl AddAssign<StringsInterner<'_>> for StringsInterner<'_>
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl<'a> Clone for StringsInterner<'a>
impl<'a> Clone for StringsInterner<'a>
sourcefn clone(&self) -> StringsInterner<'a>
fn clone(&self) -> StringsInterner<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StringsInterner<'_>
impl Debug for StringsInterner<'_>
sourceimpl Default for StringsInterner<'_>
impl Default for StringsInterner<'_>
Auto Trait Implementations
impl<'a> RefUnwindSafe for StringsInterner<'a>
impl<'a> !Send for StringsInterner<'a>
impl<'a> !Sync for StringsInterner<'a>
impl<'a> Unpin for StringsInterner<'a>
impl<'a> UnwindSafe for StringsInterner<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more