equal
deleted
inserted
replaced
27 } |
27 } |
28 |
28 |
29 impl<Data, const MAX_TIMEOUT: usize> TimedEvents<Data, MAX_TIMEOUT> { |
29 impl<Data, const MAX_TIMEOUT: usize> TimedEvents<Data, MAX_TIMEOUT> { |
30 pub fn new() -> Self { |
30 pub fn new() -> Self { |
31 Self { |
31 Self { |
32 events: iter::repeat_with(|| Slab::new()) |
32 events: [0; MAX_TIMEOUT].map(|_| Slab::new()), |
33 .take(MAX_TIMEOUT) |
|
34 .collect::<Vec<_>>() |
|
35 .try_into() |
|
36 .ok() |
|
37 .unwrap(), |
|
38 current_time: Instant::now(), |
33 current_time: Instant::now(), |
39 current_tick_index: 0, |
34 current_tick_index: 0, |
40 next_event_id: 0, |
35 next_event_id: 0, |
41 events_count: 0, |
36 events_count: 0, |
42 } |
37 } |