Struct fj_core::storage::HandleWrapper
source · 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>
Methods from Deref<Target = Handle<T>>§
sourcepub fn clone_object(&self) -> Twhere
T: Clone,
pub fn clone_object(&self) -> Twhere
T: Clone,
Return a bare object, which is a clone of the referenced stored object
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>
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 moreimpl<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> 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§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.