pub struct HandleWrapper<T>(pub Handle<T>);Expand description
A wrapper around Handle that defines equality based on identity
HandleWrapper implements Eq/PartialEq and other common traits
that are based on those, based on the identity of a stored object that the
wrapped Handle references.
This is useful, since some objects are empty (meaning, they don’t contain
any data, and don’t reference other objects). Such objects only exist to be
distinguished based on their identity. But since a bare object doesn’t have
an identity yet, there’s no meaningful way to implement Eq/PartialEq
for such a bare object type.
However, such objects are referenced by other objects, and if we want to
derive Eq/PartialEq for a referencing object, we need something that
can provide Eq/PartialEq implementations for the empty objects. That
is the purpose of HandleWrapper.
Tuple Fields§
§0: Handle<T>Implementations§
Source§impl<T> HandleWrapper<T>
impl<T> HandleWrapper<T>
Trait Implementations§
Source§impl<T> Clone for HandleWrapper<T>
impl<T> Clone for HandleWrapper<T>
Source§impl<T> Debug for HandleWrapper<T>where
T: Debug,
impl<T> Debug for HandleWrapper<T>where
T: Debug,
Source§impl<T> Deref for HandleWrapper<T>
impl<T> Deref for HandleWrapper<T>
Source§impl<T> From<Handle<T>> for HandleWrapper<T>
impl<T> From<Handle<T>> for HandleWrapper<T>
Source§impl<T> From<HandleWrapper<T>> for Handle<T>
impl<T> From<HandleWrapper<T>> for Handle<T>
Source§fn from(wrapper: HandleWrapper<T>) -> Self
fn from(wrapper: HandleWrapper<T>) -> Self
Source§impl<T> Hash for HandleWrapper<T>
impl<T> Hash for HandleWrapper<T>
Source§impl<T> Ord for HandleWrapper<T>
impl<T> Ord for HandleWrapper<T>
Source§impl<T> PartialEq for HandleWrapper<T>
impl<T> PartialEq for HandleWrapper<T>
Source§impl<T> PartialOrd for HandleWrapper<T>
impl<T> PartialOrd for HandleWrapper<T>
impl<T> Eq for HandleWrapper<T>
impl<T> Send for HandleWrapper<T>
impl<T> Sync for HandleWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for HandleWrapper<T>
impl<T> !RefUnwindSafe for HandleWrapper<T>
impl<T> Unpin for HandleWrapper<T>
impl<T> !UnwindSafe for HandleWrapper<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.