Struct async_executors::exec::AsyncGlobal
source · pub struct AsyncGlobal;
Available on crate feature
async_global
only.Expand description
An executor that spawns tasks on async-global-executor. In contrast to the other executors, this one is not self contained, because async-global-executor does not provide an API that allows that, so the threadpool is global.
It works on Wasm.
Implementations§
source§impl AsyncGlobal
impl AsyncGlobal
sourcepub fn block_on<F: Future>(future: F) -> F::Output
Available on non-target_os="unknown"
only.
pub fn block_on<F: Future>(future: F) -> F::Output
target_os="unknown"
only.Wrapper around async_global_executor::block_on. This is not available on Wasm as Wasm does not have threads and you’re not allowed to block the only thread you have.
Trait Implementations§
source§impl Clone for AsyncGlobal
impl Clone for AsyncGlobal
source§fn clone(&self) -> AsyncGlobal
fn clone(&self) -> AsyncGlobal
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AsyncGlobal
impl Debug for AsyncGlobal
source§impl Default for AsyncGlobal
impl Default for AsyncGlobal
source§fn default() -> AsyncGlobal
fn default() -> AsyncGlobal
Returns the “default value” for a type. Read more
source§impl LocalSpawn for AsyncGlobal
impl LocalSpawn for AsyncGlobal
source§fn spawn_local_obj(
&self,
future: LocalFutureObj<'static, ()>
) -> Result<(), SpawnError>
fn spawn_local_obj( &self, future: LocalFutureObj<'static, ()> ) -> Result<(), SpawnError>
Spawns a future that will be run to completion. Read more
source§fn status_local(&self) -> Result<(), SpawnError>
fn status_local(&self) -> Result<(), SpawnError>
Determines whether the executor is able to spawn new tasks. Read more
source§impl<Out: 'static> LocalSpawnHandle<Out> for AsyncGlobal
impl<Out: 'static> LocalSpawnHandle<Out> for AsyncGlobal
source§fn spawn_handle_local_obj(
&self,
future: LocalFutureObj<'static, Out>
) -> Result<JoinHandle<Out>, SpawnError>
fn spawn_handle_local_obj( &self, future: LocalFutureObj<'static, Out> ) -> Result<JoinHandle<Out>, SpawnError>
Spawn a future and return a
JoinHandle
that can be awaited for the output of the future.source§impl Spawn for AsyncGlobal
impl Spawn for AsyncGlobal
source§impl<R: Send + 'static> SpawnBlocking<R> for AsyncGlobal
impl<R: Send + 'static> SpawnBlocking<R> for AsyncGlobal
source§fn spawn_blocking<F>(&self, f: F) -> BlockingHandle<R> ⓘwhere
F: FnOnce() -> R + Send + 'static,
fn spawn_blocking<F>(&self, f: F) -> BlockingHandle<R> ⓘwhere F: FnOnce() -> R + Send + 'static,
Runs the provided closure on a thread where blocking is acceptable.
source§fn spawn_blocking_dyn(
&self,
f: Box<dyn FnOnce() -> R + Send>
) -> BlockingHandle<R> ⓘ
fn spawn_blocking_dyn( &self, f: Box<dyn FnOnce() -> R + Send> ) -> BlockingHandle<R> ⓘ
Runs the provided closure on a thread where blocking is acceptable. This part of the trait is
object safe but your closure must be boxed and you cannot have a return value.
source§impl<Out: 'static + Send> SpawnHandle<Out> for AsyncGlobal
impl<Out: 'static + Send> SpawnHandle<Out> for AsyncGlobal
source§fn spawn_handle_obj(
&self,
future: FutureObj<'static, Out>
) -> Result<JoinHandle<Out>, SpawnError>
fn spawn_handle_obj( &self, future: FutureObj<'static, Out> ) -> Result<JoinHandle<Out>, SpawnError>
Spawn a future and return a
JoinHandle
that can be awaited for the output of the future.source§impl Timer for AsyncGlobal
Available on crate feature timer
only.
impl Timer for AsyncGlobal
Available on crate feature
timer
only.source§impl YieldNow for AsyncGlobal
impl YieldNow for AsyncGlobal
source§fn yield_now(&self) -> YieldNowFut ⓘ
fn yield_now(&self) -> YieldNowFut ⓘ
Await this future in order to yield to the executor.
impl Copy for AsyncGlobal
impl TokioIo for AsyncGlobal
Available on non-WebAssembly and crate feature
async_global_tokio
only.Signal io can be used on this executor.
Auto Trait Implementations§
impl RefUnwindSafe for AsyncGlobal
impl Send for AsyncGlobal
impl Sync for AsyncGlobal
impl Unpin for AsyncGlobal
impl UnwindSafe for AsyncGlobal
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Sp> LocalSpawnExt for Spwhere
Sp: LocalSpawn + ?Sized,
impl<Sp> LocalSpawnExt for Spwhere Sp: LocalSpawn + ?Sized,
source§fn spawn_local<Fut>(&self, future: Fut) -> Result<(), SpawnError>where
Fut: Future<Output = ()> + 'static,
fn spawn_local<Fut>(&self, future: Fut) -> Result<(), SpawnError>where Fut: Future<Output = ()> + 'static,
Spawns a task that polls the given future with output
()
to
completion. Read moresource§fn spawn_local_with_handle<Fut>(
&self,
future: Fut
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>where
Fut: Future + 'static,
fn spawn_local_with_handle<Fut>( &self, future: Fut ) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>where Fut: Future + 'static,
Spawns a task that polls the given future to completion and returns a
future that resolves to the spawned future’s output. Read more
source§impl<T, Out> LocalSpawnHandleExt<Out> for Twhere
T: LocalSpawnHandle<Out> + ?Sized,
Out: 'static,
impl<T, Out> LocalSpawnHandleExt<Out> for Twhere T: LocalSpawnHandle<Out> + ?Sized, Out: 'static,
source§fn spawn_handle_local(
&self,
future: impl Future<Output = Out> + 'static
) -> Result<JoinHandle<Out>, SpawnError>
fn spawn_handle_local( &self, future: impl Future<Output = Out> + 'static ) -> Result<JoinHandle<Out>, SpawnError>
Convenience trait for passing in a generic future to
LocalSpawnHandle
. Much akin to LocalSpawn
and LocalSpawnExt
in the
futures library.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<Sp> SpawnExt for Spwhere
Sp: Spawn + ?Sized,
impl<Sp> SpawnExt for Spwhere Sp: Spawn + ?Sized,
source§fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>where
Fut: Future<Output = ()> + Send + 'static,
fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>where Fut: Future<Output = ()> + Send + 'static,
Spawns a task that polls the given future with output
()
to
completion. Read moresource§fn spawn_with_handle<Fut>(
&self,
future: Fut
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>where
Fut: Future + Send + 'static,
<Fut as Future>::Output: Send,
fn spawn_with_handle<Fut>( &self, future: Fut ) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>where Fut: Future + Send + 'static, <Fut as Future>::Output: Send,
Spawns a task that polls the given future to completion and returns a
future that resolves to the spawned future’s output. Read more
source§impl<T, Out> SpawnHandleExt<Out> for Twhere
T: SpawnHandle<Out> + ?Sized,
Out: 'static + Send,
impl<T, Out> SpawnHandleExt<Out> for Twhere T: SpawnHandle<Out> + ?Sized, Out: 'static + Send,
source§fn spawn_handle(
&self,
future: impl Future<Output = Out> + Send + 'static
) -> Result<JoinHandle<Out>, SpawnError>
fn spawn_handle( &self, future: impl Future<Output = Out> + Send + 'static ) -> Result<JoinHandle<Out>, SpawnError>
Spawn a future and return a JoinHandle that can be awaited for the output of the future.