Skip to content

Commit

Permalink
include phantom data in SystemId debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-Fenner committed Nov 12, 2023
1 parent 6346ccd commit 7f68e79
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/bevy_ecs/src/system/system_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,34 @@ pub struct SystemId<I = (), O = ()>(Entity, std::marker::PhantomData<fn(I) -> O>

// A manual impl is used because the trait bounds should ignore the `I` and `O` phantom parameters.
impl<I, O> Copy for SystemId<I, O> {}

// A manual impl is used because the trait bounds should ignore the `I` and `O` phantom parameters.
impl<I, O> Clone for SystemId<I, O> {
fn clone(&self) -> Self {
*self
}
}

// A manual impl is used because the trait bounds should ignore the `I` and `O` phantom parameters.
impl<I, O> PartialEq for SystemId<I, O> {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0 && self.1 == other.1
}
}

// A manual impl is used because the trait bounds should ignore the `I` and `O` phantom parameters.
impl<I, O> std::hash::Hash for SystemId<I, O> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}

impl<I, O> std::fmt::Debug for SystemId<I, O> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// The PhantomData field is omitted for simplicity.
f.debug_tuple("SystemId").field(&self.0).finish()
f.debug_tuple("SystemId")
.field(&self.0)
.field(&self.1)
.finish()
}
}

Expand Down

0 comments on commit 7f68e79

Please sign in to comment.