1use crate::world::World;
5use std::fmt;
6use std::sync::Arc;
7
8#[derive(Clone)]
9pub struct OnNextRound(Arc<dyn Fn(&mut World) + Send + Sync>);
10
11impl OnNextRound {
12 pub fn new<F>(f: F) -> Self
13 where
14 F: Fn(&mut World) + Send + Sync + 'static,
15 {
16 Self(Arc::new(f))
17 }
18
19 pub(crate) fn call(&self, world: &mut World) {
20 (self.0)(world);
21 }
22}
23
24impl fmt::Debug for OnNextRound {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 f.debug_tuple("OnNextRound")
27 .finish_non_exhaustive()
28 }
29}