Expand description
Create deadlines from Instant.
§Features
This module is empty when no features are enabled. To implement deadlines
for Instant you can enable one of the following features:
async-io: use this when using theasync-stdorsmolruntimes.tokio: use this when using thetokioruntime.
§Examples
use std::time::Instant;
use async_std::prelude::*;
use stop_token::prelude::*;
use stop_token::StopToken;
struct Event;
async fn do_work(work: impl Stream<Item = Event> + Unpin, deadline: Instant) {
let mut work = work.timeout_at(deadline);
while let Some(Ok(event)) = work.next().await {
process_event(event).await
}
}
async fn process_event(_event: Event) {
}