pub struct StringPool { /* private fields */ }Expand description
A pool for managing multiple PooledStrings.
Implementations§
Source§impl StringPool
impl StringPool
Sourcepub fn with_max_size(max_size: usize) -> Self
pub fn with_max_size(max_size: usize) -> Self
Creates a StringPool with the specified max size.
Sourcepub fn store(&mut self, s: &str) -> PooledString
pub fn store(&mut self, s: &str) -> PooledString
Stores a string in the pool.
Sourcepub fn get_or_insert(&mut self, s: &str) -> PooledString
pub fn get_or_insert(&mut self, s: &str) -> PooledString
Gets a string from the pool or inserts it if not present.
Sourcepub fn total_capacity(&self) -> usize
pub fn total_capacity(&self) -> usize
Returns the total capacity of all strings in the pool.
Trait Implementations§
Source§impl Debug for StringPool
impl Debug for StringPool
Auto Trait Implementations§
impl Freeze for StringPool
impl RefUnwindSafe for StringPool
impl Send for StringPool
impl Sync for StringPool
impl Unpin for StringPool
impl UnsafeUnpin for StringPool
impl UnwindSafe for StringPool
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more