Skip to content

Interval API #35

@ghost

Description

It would be great if Timer was not just a Future but also a Stream so that it could act as a "ticker" delivering events at regular intervals.

Proposed API:

impl Timer {
    fn interval(period: Duration) -> Timer;
    fn interval_at(start: Instant, period: Duration) -> Timer;

    fn set_interval(&mut self, period: Duration);
    fn set_interval_at(&mut self, start: Instant, period: Duration);
}

impl Stream for Timer {
    type Item = Instant;
}

Thoughts or suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions