diff --git a/packages/core/src/nodes.rs b/packages/core/src/nodes.rs index d00825c34..3e8638a84 100644 --- a/packages/core/src/nodes.rs +++ b/packages/core/src/nodes.rs @@ -394,7 +394,7 @@ impl AnyValueRc { /// Returns a reference to the inner value. pub fn downcast_ref(&self) -> Option<&T> { - if self.0.our_typeid() == TypeId::of::() { + if self.0.type_id() == TypeId::of::() { Some(unsafe { self.downcast_ref_unchecked() }) } else { None @@ -403,7 +403,7 @@ impl AnyValueRc { /// Checks if the inner value is of type `T`. pub fn is(&self) -> bool { - self.0.our_typeid() == TypeId::of::() + self.0.type_id() == TypeId::of::() } } @@ -468,23 +468,18 @@ impl<'a> PartialEq for AttributeValue<'a> { } #[doc(hidden)] -pub trait AnyValue { +pub trait AnyValue: Any { fn any_cmp(&self, other: &dyn AnyValue) -> bool; - fn our_typeid(&self) -> TypeId; } impl AnyValue for T { fn any_cmp(&self, other: &dyn AnyValue) -> bool { - if self.type_id() != other.our_typeid() { + if self.type_id() != other.type_id() { return false; } self == unsafe { &*(other as *const _ as *const T) } } - - fn our_typeid(&self) -> TypeId { - self.type_id() - } } #[doc(hidden)]