pub struct Every { /* private fields */ }Expand description
A timer that fires every period steps or turns.
A period of 0 acts as 1, whether given to new or read from
a file.
Implementations§
Source§impl Every
impl Every
Sourcepub fn advance(&mut self, n: u32) -> u32
pub fn advance(&mut self, n: u32) -> u32
Moves it on by n, and says how many times it fired: (since + n) / period times, keeping the remainder. The count saturates at
u32::MAX.
Sourcepub fn until_next(&self) -> u32
pub fn until_next(&self) -> u32
How far it is to its next firing: the period less how far it has
come, and 1 if that’s out of range, because the next advance(1)
fires then.
Trait Implementations§
impl Copy for Every
Source§impl<'de> Deserialize<'de> for Every
impl<'de> Deserialize<'de> for Every
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
impl Eq for Every
impl StructuralPartialEq for Every
Auto Trait Implementations§
impl Freeze for Every
impl RefUnwindSafe for Every
impl Send for Every
impl Sync for Every
impl Unpin for Every
impl UnsafeUnpin for Every
impl UnwindSafe for Every
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