pub struct Interval { /* private fields */ }
Expand description
The main struct for the interval system.
Accessed via basalt.interval_ref()
or basalt.interval()
.
Implementations
sourceimpl Interval
impl Interval
sourcepub fn do_every<F: FnMut(Option<Duration>) -> IntvlHookCtrl + Send + 'static>(
&self,
every: Duration,
delay: Option<Duration>,
method: F
) -> IntvlHookID
pub fn do_every<F: FnMut(Option<Duration>) -> IntvlHookCtrl + Send + 'static>(
&self,
every: Duration,
delay: Option<Duration>,
method: F
) -> IntvlHookID
Call the method at provided internval.
Takes a Fn(last_call: Option<Duration>) -> IntvlHookCtrl
.
last_call
: Duration since the last method was called.delay
: is the duration that has to elapsed afterInterval::start(...)
before the hook method is called.IntvlHookCtrl
: controls how the hook is handled after the method is called.
Notes
- Hooks are paused to begin with. They must be started with
Interval::start(...)
. last_call
will only beSome
if the method is called continuously. ReturningInputHookCtrl::Pause
or usingInterval::pause(...)
will cause the next call to beNone
.
sourcepub fn pause(&self, id: IntvlHookID)
pub fn pause(&self, id: IntvlHookID)
sourcepub fn start(&self, id: IntvlHookID)
pub fn start(&self, id: IntvlHookID)
sourcepub fn remove(&self, id: IntvlHookID)
pub fn remove(&self, id: IntvlHookID)
Auto Trait Implementations
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more