From 476e2965616e21cad731a49465c6959d7151236f Mon Sep 17 00:00:00 2001 From: James Liu Date: Fri, 29 Mar 2024 07:49:13 -0700 Subject: [PATCH] Implement Clone for ManualEventReader (#12777) # Objective Fix #12764. ## Solution Implement Clone for the type. --- crates/bevy_ecs/src/event.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/bevy_ecs/src/event.rs b/crates/bevy_ecs/src/event.rs index 62cfce6329..af7b6df6b6 100644 --- a/crates/bevy_ecs/src/event.rs +++ b/crates/bevy_ecs/src/event.rs @@ -614,6 +614,15 @@ impl Default for ManualEventReader { } } +impl Clone for ManualEventReader { + fn clone(&self) -> Self { + ManualEventReader { + last_event_count: self.last_event_count, + _marker: PhantomData, + } + } +} + #[allow(clippy::len_without_is_empty)] // Check fails since the is_empty implementation has a signature other than `(&self) -> bool` impl ManualEventReader { /// See [`EventReader::read`]