pub struct Interval { /* private fields */ }
Expand description
Stream returned by interval
and interval_at
.
Implementations§
Source§impl Interval
impl Interval
Sourcepub async fn tick(&mut self) -> Instant
pub async fn tick(&mut self) -> Instant
Completes when the next instant in the interval has been reached.
§Examples
use kayrx_timer;
use std::time::Duration;
use kayrx_karx;
fn main() {
kayrx_karx::exec(async {
let mut interval = timer::interval(Duration::from_millis(10));
interval.tick().await;
interval.tick().await;
interval.tick().await;
// approximately 20ms have elapsed.
});
}
Trait Implementations§
Source§impl Stream for Interval
impl Stream for Interval
Auto Trait Implementations§
impl Freeze for Interval
impl !RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl !UnwindSafe for Interval
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