pub struct HashableWeak<T: ?Sized>(pub Weak<T>);Expand description
Weak<T> newtype that hashes and compares by the underlying
allocation address, so it can be stored in a HashSet or used
as a HashMap key.
Equality uses Weak::ptr_eq. The ptr_eq semantics are
documented as unspecified once the original allocation has been
dropped, so callers should periodically prune dead entries (via
Weak::upgrade returning None) to keep the set hygienic. With
timely pruning, the only observable consequence of a stale
entry colliding with a new live entry is that the live entry
replaces the stale one on insert — which is the desired outcome
anyway.
Tuple Fields§
§0: Weak<T>Implementations§
Trait Implementations§
Source§impl<T: ?Sized> Clone for HashableWeak<T>
impl<T: ?Sized> Clone for HashableWeak<T>
Source§impl<T> Hash for HashableWeak<T>
impl<T> Hash for HashableWeak<T>
Source§impl<T: ?Sized> PartialEq for HashableWeak<T>
impl<T: ?Sized> PartialEq for HashableWeak<T>
impl<T: ?Sized> Eq for HashableWeak<T>
Auto Trait Implementations§
impl<T> Freeze for HashableWeak<T>where
T: ?Sized,
impl<T> RefUnwindSafe for HashableWeak<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for HashableWeak<T>
impl<T> Sync for HashableWeak<T>
impl<T> Unpin for HashableWeak<T>where
T: ?Sized,
impl<T> UnwindSafe for HashableWeak<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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