pub trait AsyncLocalAfterSpawner: Copy + 'static {
type JoinError: Debug + Display + 'static;
type JoinHandle<F>: LocalAfterHandle<F, Self::JoinError>
where F: 'static;
// Required methods
fn spawn_local_after<F>(
duration: Duration,
future: F
) -> Self::JoinHandle<F::Output>
where F::Output: 'static,
F: Future + 'static;
fn spawn_local_after_at<F>(
instant: Instant,
future: F
) -> Self::JoinHandle<F::Output>
where F::Output: 'static,
F: Future + 'static;
// Provided methods
fn spawn_local_after_detach<F>(duration: Duration, future: F)
where F::Output: 'static,
F: Future + 'static { ... }
fn spawn_local_after_at_detach<F>(instant: Instant, future: F)
where F::Output: 'static,
F: Future + 'static { ... }
}Available on crate feature
time only.Expand description
A spawner trait for spawning futures locally. Go’s time.AfterFunc equivalent.
Required Associated Types§
sourcetype JoinHandle<F>: LocalAfterHandle<F, Self::JoinError>
where
F: 'static
type JoinHandle<F>: LocalAfterHandle<F, Self::JoinError> where F: 'static
The handle returned by the spawner when a future is spawned.
Required Methods§
sourcefn spawn_local_after<F>(
duration: Duration,
future: F
) -> Self::JoinHandle<F::Output>
fn spawn_local_after<F>( duration: Duration, future: F ) -> Self::JoinHandle<F::Output>
Spawn a future onto the runtime and run the given future after the given duration
sourcefn spawn_local_after_at<F>(
instant: Instant,
future: F
) -> Self::JoinHandle<F::Output>
fn spawn_local_after_at<F>( instant: Instant, future: F ) -> Self::JoinHandle<F::Output>
Spawn a future onto the runtime and run the given future after reach the given instant
Provided Methods§
sourcefn spawn_local_after_detach<F>(duration: Duration, future: F)
fn spawn_local_after_detach<F>(duration: Duration, future: F)
Spawn and detach a future onto the runtime and run the given future after the given duration
sourcefn spawn_local_after_at_detach<F>(instant: Instant, future: F)
fn spawn_local_after_at_detach<F>(instant: Instant, future: F)
Spawn and detach a future onto the runtime and run the given future after reach the given instant
Object Safety§
This trait is not object safe.
Implementors§
source§impl AsyncLocalAfterSpawner for AsyncStdSpawner
Available on crate feature async-std only.
impl AsyncLocalAfterSpawner for AsyncStdSpawner
Available on crate feature
async-std only.type JoinError = Infallible
type JoinHandle<F> = AsyncStdAfterHandle<F> where F: 'static
source§impl AsyncLocalAfterSpawner for SmolSpawner
Available on crate feature smol only.
impl AsyncLocalAfterSpawner for SmolSpawner
Available on crate feature
smol only.type JoinError = Canceled
type JoinHandle<F> = SmolAfterHandle<F> where F: 'static
source§impl AsyncLocalAfterSpawner for TokioSpawner
Available on crate feature tokio only.
impl AsyncLocalAfterSpawner for TokioSpawner
Available on crate feature
tokio only.type JoinError = JoinError
type JoinHandle<F> = TokioAfterHandle<F> where F: 'static
source§impl AsyncLocalAfterSpawner for WasmSpawner
Available on crate feature wasm only.
impl AsyncLocalAfterSpawner for WasmSpawner
Available on crate feature
wasm only.