Struct async_executors::exec::AsyncGlobal
source · [−]pub struct AsyncGlobal;
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
sourceimpl 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
sourceimpl Clone for AsyncGlobal
impl Clone for AsyncGlobal
sourcefn clone(&self) -> AsyncGlobal
fn clone(&self) -> AsyncGlobal
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AsyncGlobal
impl Debug for AsyncGlobal
sourceimpl Default for AsyncGlobal
impl Default for AsyncGlobal
sourcefn default() -> AsyncGlobal
fn default() -> AsyncGlobal
Returns the “default value” for a type. Read more
sourceimpl LocalSpawn for AsyncGlobal
impl LocalSpawn for AsyncGlobal
sourcefn 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
sourcefn status_local(&self) -> Result<(), SpawnError>
fn status_local(&self) -> Result<(), SpawnError>
Determines whether the executor is able to spawn new tasks. Read more
sourceimpl<Out: 'static> LocalSpawnHandle<Out> for AsyncGlobal
impl<Out: 'static> LocalSpawnHandle<Out> for AsyncGlobal
sourcefn 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.
sourceimpl Spawn for AsyncGlobal
impl Spawn for AsyncGlobal
sourceimpl<R: Send + 'static> SpawnBlocking<R> for AsyncGlobal
impl<R: Send + 'static> SpawnBlocking<R> for AsyncGlobal
sourcefn spawn_blocking<F>(&self, f: F) -> BlockingHandle<R>ⓘNotable traits for BlockingHandle<T>impl<T: 'static> Future for BlockingHandle<T> type Output = T;
where
F: FnOnce() -> R + Send + 'static,
fn spawn_blocking<F>(&self, f: F) -> BlockingHandle<R>ⓘNotable traits for BlockingHandle<T>impl<T: 'static> Future for BlockingHandle<T> type Output = T;
where
F: FnOnce() -> R + Send + 'static,
Runs the provided closure on a thread where blocking is acceptable.
sourcefn spawn_blocking_dyn(
&self,
f: Box<dyn FnOnce() -> R + Send>
) -> BlockingHandle<R>ⓘNotable traits for BlockingHandle<T>impl<T: 'static> Future for BlockingHandle<T> type Output = T;
fn spawn_blocking_dyn(
&self,
f: Box<dyn FnOnce() -> R + Send>
) -> BlockingHandle<R>ⓘNotable traits for BlockingHandle<T>impl<T: 'static> Future for BlockingHandle<T> type Output = T;
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. Read more
sourceimpl<Out: 'static + Send> SpawnHandle<Out> for AsyncGlobal
impl<Out: 'static + Send> SpawnHandle<Out> for AsyncGlobal
sourcefn 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.
sourceimpl Timer for AsyncGlobal
Available on crate feature timer
only.
impl Timer for AsyncGlobal
timer
only.sourceimpl YieldNow for AsyncGlobal
impl YieldNow for AsyncGlobal
sourcefn yield_now(&self) -> YieldNowFutⓘNotable traits for YieldNowFutimpl Future for YieldNowFut type Output = ();
fn yield_now(&self) -> YieldNowFutⓘNotable traits for YieldNowFutimpl Future for YieldNowFut type Output = ();
Await this future in order to yield to the executor.
impl Copy for AsyncGlobal
impl TokioIo for AsyncGlobal
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<Sp> LocalSpawnExt for Sp where
Sp: LocalSpawn + ?Sized,
impl<Sp> LocalSpawnExt for Sp where
Sp: LocalSpawn + ?Sized,
sourcefn spawn_local<Fut>(&self, future: Fut) -> Result<(), SpawnError> where
Fut: 'static + Future<Output = ()>,
fn spawn_local<Fut>(&self, future: Fut) -> Result<(), SpawnError> where
Fut: 'static + Future<Output = ()>,
Spawns a task that polls the given future with output ()
to
completion. Read more
sourcefn spawn_local_with_handle<Fut>(
&self,
future: Fut
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError> where
Fut: 'static + Future,
fn spawn_local_with_handle<Fut>(
&self,
future: Fut
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError> where
Fut: 'static + Future,
Spawns a task that polls the given future to completion and returns a future that resolves to the spawned future’s output. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<Sp> SpawnExt for Sp where
Sp: Spawn + ?Sized,
impl<Sp> SpawnExt for Sp where
Sp: Spawn + ?Sized,
sourcefn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError> where
Fut: 'static + Future<Output = ()> + Send,
fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError> where
Fut: 'static + Future<Output = ()> + Send,
Spawns a task that polls the given future with output ()
to
completion. Read more
sourcefn spawn_with_handle<Fut>(
&self,
future: Fut
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError> where
Fut: 'static + Future + Send,
<Fut as Future>::Output: Send,
fn spawn_with_handle<Fut>(
&self,
future: Fut
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError> where
Fut: 'static + Future + Send,
<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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more