pub struct HandleWrapper<T>(pub Handle<T>);Expand description
A wrapper around Handle to define equality based on identity
This is a utility type that implements Eq/PartialEq and other common
traits that are based on those, based on the identity of object that the
wrapped handle references. This is useful, if a type of object doesn’t
implement Eq/PartialEq, which means handles referencing it won’t
implement those types either.
Typically, if an object doesn’t implement Eq/PartialEq, it will do
so for good reason. If you need something that represents the object and
implements those missing traits, you might want to be explicit about what
you’re doing, and access its ID via Handle::id instead.
But if you have a struct that owns a Handle to such an object, and you
want to be able to derive various traits that are not available for the
Handle itself, this wrapper is for you.
Tuple Fields§
§0: Handle<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.