pub trait LocalExecutor {
type Task<T: 'static>: Task<T>;
// Required method
fn spawn_local<Fut>(&self, fut: Fut) -> Self::Task<Fut::Output>
where Fut: Future + 'static;
}
Expand description
A trait for spawning 'static
futures that may not be Send
.
This trait is for executors that can spawn futures that don’t need to be Send
,
typically single-threaded executors or local task spawners.
The 'static
lifetime requirements come from the underlying async runtimes
which need to ensure memory safety when tasks may outlive their spawning scope,
even in single-threaded contexts.
See AnyLocalExecutor for a type-erased local executor.
web::WebExecutor
for WASM environments
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<E: LocalExecutor> LocalExecutor for &E
impl<E: LocalExecutor> LocalExecutor for &E
Source§impl<E: LocalExecutor> LocalExecutor for &mut E
impl<E: LocalExecutor> LocalExecutor for &mut E
Source§impl<E: LocalExecutor> LocalExecutor for Box<E>
impl<E: LocalExecutor> LocalExecutor for Box<E>
Source§impl<E: LocalExecutor> LocalExecutor for Rc<E>
impl<E: LocalExecutor> LocalExecutor for Rc<E>
Source§impl<E: LocalExecutor> LocalExecutor for Arc<E>
impl<E: LocalExecutor> LocalExecutor for Arc<E>
Implementors§
Source§impl LocalExecutor for LocalExecutor<'static>
Available on crate feature async-executor
only.
impl LocalExecutor for LocalExecutor<'static>
Available on crate feature
async-executor
only.Source§impl LocalExecutor for AnyLocalExecutor
impl LocalExecutor for AnyLocalExecutor
type Task<T: 'static> = AnyLocalExecutorTask<T>
Source§impl LocalExecutor for DefaultExecutor
impl LocalExecutor for DefaultExecutor
type Task<T: 'static> = AnyLocalExecutorTask<T>
Source§impl LocalExecutor for LocalSet
Available on crate feature tokio
only.
impl LocalExecutor for LocalSet
Available on crate feature
tokio
only.type Task<T: 'static> = TokioLocalTask<T>
Source§impl LocalExecutor for TokioExecutor
Available on crate feature tokio
only.
impl LocalExecutor for TokioExecutor
Available on crate feature
tokio
only.type Task<T: 'static> = TokioLocalTask<T>
Source§impl LocalExecutor for WebExecutor
Available on crate feature web
only.
impl LocalExecutor for WebExecutor
Available on crate feature
web
only.