Struct async_executors::exec::AsyncStd
source · pub struct AsyncStd;
Available on crate feature
async_std
only.Expand description
An executor that spawns tasks on async-std. In contrast to the other executors, this one is not self contained, because async-std does not provide an API that allows that, so the threadpool is global.
It works on Wasm.
Implementations§
Trait Implementations§
source§impl LocalSpawn for AsyncStd
impl LocalSpawn for AsyncStd
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 AsyncStd
impl<Out: 'static> LocalSpawnHandle<Out> for AsyncStd
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<R: Send + 'static> SpawnBlocking<R> for AsyncStd
impl<R: Send + 'static> SpawnBlocking<R> for AsyncStd
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 AsyncStd
impl<Out: 'static + Send> SpawnHandle<Out> for AsyncStd
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 YieldNow for AsyncStd
impl YieldNow for AsyncStd
source§fn yield_now(&self) -> YieldNowFut ⓘ
fn yield_now(&self) -> YieldNowFut ⓘ
Await this future in order to yield to the executor.
impl Copy for AsyncStd
impl TokioIo for AsyncStd
Available on non-WebAssembly and crate feature
async_std_tokio
only.Signal io can be used on this executor.
Auto Trait Implementations§
impl RefUnwindSafe for AsyncStd
impl Send for AsyncStd
impl Sync for AsyncStd
impl Unpin for AsyncStd
impl UnwindSafe for AsyncStd
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.