Skip to content

Commit 727184b

Browse files
committed
use ptr::eq and ptr::hash
1 parent daaaed9 commit 727184b

File tree

1 file changed

+26
-2
lines changed
  • crates/bevy_ecs/src/schedule

1 file changed

+26
-2
lines changed

crates/bevy_ecs/src/schedule/set.rs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ where
5151
pub trait ScheduleLabel: DynHash + Debug + Send + Sync + 'static {}
5252

5353
/// A lightweight and printable identifier for a [`Schedule`](super::Schedule).
54-
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
54+
#[derive(Clone, Copy, Eq)]
5555
pub struct ScheduleId(&'static str);
5656

5757
impl ScheduleId {
@@ -62,6 +62,18 @@ impl ScheduleId {
6262
}
6363
}
6464

65+
impl PartialEq for ScheduleId {
66+
fn eq(&self, other: &Self) -> bool {
67+
std::ptr::eq(self.0, other.0)
68+
}
69+
}
70+
71+
impl Hash for ScheduleId {
72+
fn hash<H: Hasher>(&self, state: &mut H) {
73+
std::ptr::hash(self.0, state);
74+
}
75+
}
76+
6577
impl Debug for ScheduleId {
6678
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6779
self.0.fmt(f)
@@ -98,7 +110,7 @@ pub trait SystemSet: DynHash + Debug + Send + Sync + 'static {
98110
}
99111

100112
/// A lightweight and printable identifier for a [`SystemSet`].
101-
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
113+
#[derive(Clone, Copy, Eq)]
102114
pub struct SystemSetId(&'static str);
103115

104116
impl SystemSetId {
@@ -109,6 +121,18 @@ impl SystemSetId {
109121
}
110122
}
111123

124+
impl PartialEq for SystemSetId {
125+
fn eq(&self, other: &Self) -> bool {
126+
std::ptr::eq(self.0, other.0)
127+
}
128+
}
129+
130+
impl Hash for SystemSetId {
131+
fn hash<H: Hasher>(&self, state: &mut H) {
132+
std::ptr::hash(self.0, state);
133+
}
134+
}
135+
112136
impl Debug for SystemSetId {
113137
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
114138
self.0.fmt(f)

0 commit comments

Comments
 (0)