Struct arc_interner::ArcIntern [−][src]
Expand description
A pointer to a reference-counted interned object.
The interned object will be held in memory only until its reference count reaches zero.
Example
use arc_interner::ArcIntern;
let x = ArcIntern::new("hello");
let y = ArcIntern::new("world");
assert_ne!(x, y);
assert_eq!(x, ArcIntern::new("hello"));
assert_eq!(*x, "hello"); // dereference an ArcIntern like a pointer
Implementations
Intern a value. If this value has not previously been
interned, then new
will allocate a spot for the value on the
heap. Otherwise, it will return a pointer to the object
previously allocated.
Note that ArcIntern::new
is a bit slow, since it needs to check
a DashMap
which contains its own mutexes.
Trait Implementations
impl<'de, T: Eq + Hash + Send + Sync + 'static + ?Sized + Deserialize<'de>> Deserialize<'de> for ArcIntern<T>
impl<'de, T: Eq + Hash + Send + Sync + 'static + ?Sized + Deserialize<'de>> Deserialize<'de> for ArcIntern<T>
Deserialize this value from the given Serde deserializer. Read more
Efficiently compares two interned values by comparing their pointers.
impl<T: Eq + Hash + Send + Sync + PartialOrd + ?Sized> PartialOrd<ArcIntern<T>> for ArcIntern<T>
impl<T: Eq + Hash + Send + Sync + PartialOrd + ?Sized> PartialOrd<ArcIntern<T>> for ArcIntern<T>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for ArcIntern<T> where
T: RefUnwindSafe,
impl<T: ?Sized> UnwindSafe for ArcIntern<T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more