// file: crates/engines/engine-v1-common/src/frame.rs // version: 1 /// Immutable timing information associated with one engine update. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct EngineFrame { index: u64, delta: std::time::Duration, elapsed: std::time::Duration, } impl EngineFrame { /// Creates timing information for one update. #[must_use] pub const fn new(index: u64, delta: std::time::Duration, elapsed: std::time::Duration) -> Self { return Self { index, delta, elapsed }; } /// Returns the zero-based update index. #[must_use] pub const fn index(self) -> u64 { return self.index; } /// Returns the duration represented by this update. #[must_use] pub const fn delta(self) -> std::time::Duration { return self.delta; } /// Returns the accumulated simulated duration before this update completes. #[must_use] pub const fn elapsed(self) -> std::time::Duration { return self.elapsed; } }