Struct rhai::StringsInterner
source · pub struct StringsInterner { /* private fields */ }
Expand description
(internals) A cache for interned strings.
Exported under the internals
feature only.
Implementations§
source§impl StringsInterner
impl StringsInterner
sourcepub fn new(max_strings_interned: usize) -> Self
pub fn new(max_strings_interned: usize) -> Self
Create a new StringsInterner
.
sourcepub fn get(
&mut self,
text: impl AsRef<str> + Into<ImmutableString>
) -> ImmutableString
pub fn get( &mut self, text: impl AsRef<str> + Into<ImmutableString> ) -> 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,
category: u8,
mapper: impl FnOnce(S) -> ImmutableString,
text: S
) -> ImmutableString
pub fn get_with_mapper<S: AsRef<str>>( &mut self, category: u8, mapper: impl FnOnce(S) -> ImmutableString, text: S ) -> ImmutableString
Get an identifier from a text string, adding it to the interner if necessary.
Trait Implementations§
source§impl AddAssign<&StringsInterner> for StringsInterner
impl AddAssign<&StringsInterner> for StringsInterner
source§fn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
Performs the
+=
operation. Read moresource§impl AddAssign for StringsInterner
impl AddAssign for StringsInterner
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl Clone for StringsInterner
impl Clone for StringsInterner
source§fn clone(&self) -> StringsInterner
fn clone(&self) -> StringsInterner
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for StringsInterner
impl RefUnwindSafe for StringsInterner
impl !Send for StringsInterner
impl !Sync for StringsInterner
impl Unpin for StringsInterner
impl UnwindSafe for StringsInterner
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Variant for T
impl<T> Variant for T
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this
Variant
trait object to &mut dyn Any
.source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this
Variant
trait object to Box<dyn Any>
.