Add dedup check for events
This commit is contained in:
parent
50735ddb31
commit
7def5ee520
1 changed files with 2 additions and 0 deletions
|
@ -181,6 +181,8 @@ fn events_and_systems(update: &Update) -> TokenStream2 {
|
||||||
P: std::any::Any + Send + Sync,
|
P: std::any::Any + Send + Sync,
|
||||||
{
|
{
|
||||||
fn add_reader(&mut self, func: Func) {
|
fn add_reader(&mut self, func: Func) {
|
||||||
|
#( #verify_dedup )*
|
||||||
|
|
||||||
match self.events.get_mut(&TypeId::of::<P>()) {
|
match self.events.get_mut(&TypeId::of::<P>()) {
|
||||||
Some((_, listener)) => listener.push(std::sync::Arc::new(move |world, payload| {
|
Some((_, listener)) => listener.push(std::sync::Arc::new(move |world, payload| {
|
||||||
let typed_payload: &P = payload.downcast_ref().unwrap();
|
let typed_payload: &P = payload.downcast_ref().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue