Struct tokio::time::Interval[][src]

pub struct Interval { /* fields omitted */ }

Stream returned by interval and interval_at.

This type only implements the Stream trait if the “stream” feature is enabled.

Implementations

impl Interval[src]

pub async fn tick(&mut self) -> Instant[src]

Completes when the next instant in the interval has been reached.

Examples

use tokio::time;

use std::time::Duration;

#[tokio::main]
async fn main() {
    let mut interval = time::interval(Duration::from_millis(10));

    interval.tick().await;
    interval.tick().await;
    interval.tick().await;

    // approximately 20ms have elapsed.
}

Trait Implementations

impl Debug for Interval[src]

impl Stream for Interval[src]

type Item = Instant

Values yielded by the stream.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<St> StreamExt for St where
    St: Stream + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.