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 struct.
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>Available on crate feature
§server only.elapsed: usizeImplementations§
source§impl Timer
impl Timer
pub fn elapsed(&self) -> usize
Available on crate feature
server only.pub fn update(&mut self)
Available on crate feature
server only.pub fn fire_event(&self, event: TimerEvent)
Available on crate feature
server only.pub fn fire_events(&self, events: impl IntoIterator<Item = TimerEvent>)
Available on crate feature
server only.pub fn start(&mut self) -> Result<()>
Available on crate feature
server only.pub fn set(&mut self, duration: usize) -> Result<()>
Available on crate feature
server only.pub fn pause(&mut self) -> Result<()>
Available on crate feature
server only.pub fn resume(&mut self) -> Result<()>
Available on crate feature
server only.pub fn stop(&mut self) -> Result<()>
Available on crate feature
server only.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 for Timer
impl PartialEq 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