use crate::{RunPhase, RuntimeTick};
#[doc = crate::_tags!(runtime time)]
#[doc = crate::_doc_meta!{
location("run/time"),
#[cfg(target_pointer_width = "32")]
test_size_of(__: RunStep<'_, ()> = 20|160),
#[cfg(target_pointer_width = "64")]
test_size_of(__: RunStep<'_, ()> = 32|256),
}]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct RunStep<'a, E = ()> {
tick: RuntimeTick,
phase: RunPhase,
events: &'a [E],
}
impl<'a, E> RunStep<'a, E> {
pub const fn new(tick: RuntimeTick, phase: RunPhase, events: &'a [E]) -> Self {
Self { tick, phase, events }
}
pub const fn tick(&self) -> RuntimeTick {
self.tick
}
pub const fn phase(&self) -> RunPhase {
self.phase
}
pub const fn events(&self) -> &'a [E] {
self.events
}
pub const fn is_running(&self) -> bool {
matches!(self.phase, RunPhase::Running)
}
}