pub struct InternPool { /* private fields */ }Expand description
Shared string interner used across the llmcc core.
Thread-safe wrapper around InternPoolInner using Arc for shared ownership.
Implementations§
Source§impl InternPool
impl InternPool
Sourcepub fn intern<S>(&self, value: S) -> InternedStr
pub fn intern<S>(&self, value: S) -> InternedStr
Intern the provided string slice and return its symbol.
Sourcepub fn intern_batch<S>(
&self,
values: impl IntoIterator<Item = S>,
) -> Vec<InternedStr> ⓘ
pub fn intern_batch<S>( &self, values: impl IntoIterator<Item = S>, ) -> Vec<InternedStr> ⓘ
Intern multiple strings and return a vector of their symbols.
Sourcepub fn resolve_owned(&self, symbol: InternedStr) -> Option<String>
pub fn resolve_owned(&self, symbol: InternedStr) -> Option<String>
Resolve an interned symbol back into an owned string.
Clones the underlying string from the interner to avoid lifetime issues.
Sourcepub fn with_resolved<R, F>(&self, symbol: InternedStr, f: F) -> Option<R>
pub fn with_resolved<R, F>(&self, symbol: InternedStr, f: F) -> Option<R>
Resolve an interned symbol and apply a closure while the borrow is active.
Trait Implementations§
Source§impl Clone for InternPool
impl Clone for InternPool
Source§fn clone(&self) -> InternPool
fn clone(&self) -> InternPool
Returns a duplicate 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 moreSource§impl Debug for InternPool
impl Debug for InternPool
Auto Trait Implementations§
impl Freeze for InternPool
impl !RefUnwindSafe for InternPool
impl Send for InternPool
impl Sync for InternPool
impl Unpin for InternPool
impl !UnwindSafe for InternPool
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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