pub struct Intern<T: ?Sized>(Arc<T>);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.
Tuple Fields§
§0: Arc<T>Implementations§
Trait Implementations§
impl<T: Eq + ?Sized> Eq for Intern<T>
Source§impl<T: Ord + ?Sized> Ord for Intern<T>
impl<T: Ord + ?Sized> Ord for Intern<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialOrd + ?Sized> PartialOrd for Intern<T>
impl<T: PartialOrd + ?Sized> PartialOrd for Intern<T>
impl<T: PartialEq + ?Sized> StructuralPartialEq for Intern<T>
Auto Trait Implementations§
impl<T> Forget for Intern<T>where
T: ?Sized,
impl<T> Freeze for Intern<T>
impl<T> Move for Intern<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Intern<T>
impl<T> Send for Intern<T>
impl<T> Sync for Intern<T>
impl<T> Unpin for Intern<T>
impl<T> UnsafeUnpin for Intern<T>
impl<T> UnwindSafe for Intern<T>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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