1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/// Unique identifier of an event inside a wheel instance.
///
/// IDs are assigned by [`HashedWheelTimer::schedule`](crate::HashedWheelTimer::schedule)
/// and preserved by update/reschedule operations.
pub type EventId = u64;
/// A scheduled event stored in the wheel.
///
/// `Event` values are returned by read/pop/remove operations.
/// They carry metadata used by the wheel scheduler:
/// - [`tick`](Self::tick): absolute tick when the event can be processed.
/// - [`delta_tick`](Self::delta_tick): wave index within the same `tick`.
///
/// # Example
/// ```
/// use okee_wheel_timer::HashedWheelTimer;
///
/// let mut wheel = HashedWheelTimer::new(8);
/// let id = wheel.schedule(0, "payload").id;
///
/// let events = wheel.pop_events();
/// assert_eq!(events[0].id(), id);
/// assert_eq!(events[0].tick(), 0);
/// assert_eq!(events[0].data(), &"payload");
/// ```