Struct async_timer::Timed [−][src]
pub struct Timed<'a, F, T = PlatformTimer> { /* fields omitted */ }
Expand description
Limiter on time to wait for underlying Future
Usage
async fn job() {
}
async fn do_job() {
let mut job = job();
let job = unsafe {
core::pin::Pin::new_unchecked(&mut job)
};
let work = unsafe {
async_timer::Timed::platform_new(job, core::time::Duration::from_secs(1))
};
match work.await {
Ok(_) => println!("I'm done!"),
//You can retry by polling `expired`
Err(expired) => println!("Job expired: {}", expired),
}
}
Implementations
Trait Implementations
Auto Trait Implementations
impl<'a, F, T> RefUnwindSafe for Timed<'a, F, T> where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, F, T = WinTimer> !UnwindSafe for Timed<'a, F, T>
Blanket Implementations
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (
into_future
)The output that the future will produce on completion.
type Future = F
type Future = F
🔬 This is a nightly-only experimental API. (
into_future
)Which kind of future are we turning this into?
🔬 This is a nightly-only experimental API. (
into_future
)Creates a future from a value.