pub struct Intern<T: ?Sized>(/* private fields */);Expand description
A wrapper around Arc representing owned InternCache entries.
The wrapper type serves the purpose of semantic meaning only, implying that this value is cached in some way or another by this module.
We only conveniently allow obtaining the underlying Arc with a From but not the
other way around. This means that interfacing code can make the type to
“forget” it originated from an InternCache but not the other way around,
i.e. cannot accidentally create fake entries that look like they came from an
InternCache. If one really has to circumvent this, then the
Intern::new_uncached_uninterned() method exists.
This ensures that interning is done everywhere that it’s expected, avoiding excess memory usage.
Implementations§
Trait Implementations§
impl<T: Eq + ?Sized> Eq for Intern<T>
impl<T: PartialEq + ?Sized> StructuralPartialEq for Intern<T>
Auto Trait Implementations§
impl<T> Freeze for Intern<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Intern<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Intern<T>
impl<T> Sync for Intern<T>
impl<T> Unpin for Intern<T>where
T: ?Sized,
impl<T> UnsafeUnpin for Intern<T>where
T: ?Sized,
impl<T> UnwindSafe for Intern<T>where
T: RefUnwindSafe + ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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