Struct intern_arc::InternedOrd
source · #[repr(transparent)]pub struct InternedOrd<T: ?Sized + Ord>(_);Expand description
An interned value
This type works very similar to an Arc
with the difference that it has no concept of weak references. They are not needed because
interned values must not be modified, so reference cycles cannot be constructed. One
reference is held by the interner that created this value as long as that interner lives.
Keeping interned values around does not keep the interner alive: once the last reference to the interner is dropped, it will release its existing references to interned values by dropping its set implementation. Only the direct allocation size of the set implementation remains allocated (but no longer functional) until the last weak reference to the interner goes away — each interned value keeps one such weak reference to its interner.
Implementations§
source§impl<T: ?Sized + Ord> InternedOrd<T>
impl<T: ?Sized + Ord> InternedOrd<T>
sourcepub fn ref_count(&self) -> u32
pub fn ref_count(&self) -> u32
Obtain current number of references, including this one.
The value will always be at least 1. If the value is 1, this means that the interner which produced this reference has been dropped; in this case you are still free to use this reference in any way you like.
Trait Implementations§
source§impl<T: ?Sized + Ord> Ord for InternedOrd<T>
impl<T: ?Sized + Ord> Ord for InternedOrd<T>
source§impl<T> PartialEq<InternedOrd<T>> for InternedOrd<T>where
T: PartialEq + ?Sized + Ord,
impl<T> PartialEq<InternedOrd<T>> for InternedOrd<T>where T: PartialEq + ?Sized + Ord,
source§impl<T> PartialOrd<InternedOrd<T>> for InternedOrd<T>where
T: PartialOrd + ?Sized + Ord,
impl<T> PartialOrd<InternedOrd<T>> for InternedOrd<T>where T: PartialOrd + ?Sized + Ord,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more