pub struct Timer {
pub config: TimerConfig,
pub state: TimerState,
pub cycle: TimerCycle,
pub cycles_count: TimerLoop,
pub started_at: Option<Instant>,
pub elapsed: usize,
}Expand description
The timer.
Fields§
§config: TimerConfigThe current timer configuration.
state: TimerStateThe current timer state.
cycle: TimerCycleThe current timer cycle.
cycles_count: TimerLoopThe current cycles counter.
started_at: Option<Instant>§elapsed: usizeImplementations§
source§impl Timer
impl Timer
pub fn elapsed(&self) -> usize
pub fn update(&mut self)
pub fn fire_event(&self, event: TimerEvent)
pub fn fire_events(&self, events: impl IntoIterator<Item = TimerEvent>)
pub fn start(&mut self) -> Result<()>
pub fn set(&mut self, duration: usize) -> Result<()>
pub fn pause(&mut self) -> Result<()>
pub fn resume(&mut self) -> Result<()>
pub fn stop(&mut self) -> Result<()>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Timer
impl<'de> Deserialize<'de> for Timer
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Timer> for Timer
impl PartialEq<Timer> for Timer
impl Eq for Timer
Auto Trait Implementations§
impl !RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl !UnwindSafe for Timer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more