datex_core/shared_values/shared_container/
equality.rs1use crate::{
2 shared_values::{
3 SharedContainer,
4 traits::{_ExposeRcInternal, SharedContainerCommon},
5 },
6 traits::{
7 identity::Identity, structural_eq::StructuralEq, value_eq::ValueEq,
8 },
9};
10use alloc::rc::Rc;
11use core::hash::{Hash, Hasher};
12
13impl Eq for SharedContainer {}
14
15impl PartialEq for SharedContainer {
17 fn eq(&self, other: &Self) -> bool {
18 self.identical(other)
19 }
20}
21
22impl Hash for SharedContainer {
23 fn hash<H: Hasher>(&self, state: &mut H) {
24 let ptr = Rc::as_ptr(self.get_rc_internal());
25 ptr.hash(state); }
27}
28
29impl StructuralEq for SharedContainer {
30 fn structural_eq(&self, other: &Self) -> bool {
31 self.inner()
32 .base_shared_container()
33 .value_container()
34 .structural_eq(
35 other.inner().base_shared_container().value_container(),
36 )
37 }
38}
39
40impl ValueEq for SharedContainer {
41 fn value_eq(&self, other: &Self) -> bool {
42 self.inner()
43 .base_shared_container()
44 .value_container()
45 .value_eq(other.inner().base_shared_container().value_container())
46 }
47}