pub struct TokioRuntimeExecutor { /* private fields */ }Implementations§
Source§impl TokioRuntimeExecutor
impl TokioRuntimeExecutor
Sourcepub fn with_single_thread() -> Result<Self>
pub fn with_single_thread() -> Result<Self>
Creates a tokio runtime with the current thread scheduler selected.
Sourcepub fn with_multi_thread() -> Result<Self>
pub fn with_multi_thread() -> Result<Self>
Creates a tokio runtime with multi-thread scheduler selected.
Sourcepub fn with_runtime(runtime: Runtime) -> Self
pub fn with_runtime(runtime: Runtime) -> Self
Create an executor with the supplied Runtime.
Note that the runtime remains alive until the final clone of this executor is dropped.
Sourcepub fn with_handle(handle: Handle) -> Self
pub fn with_handle(handle: Handle) -> Self
Create an executor with the supplied Runtime.
Note that this executor does not own or keep the associated runtime alive. The runtime must remain running for spawned tasks to execute.
Sourcepub fn from_current_handle() -> Result<Self>
pub fn from_current_handle() -> Result<Self>
Create an executor from the existing Runtime
Note that this returns an error when called outside a Tokio runtime context. The resulting executor does not prevent that runtime from shutting down.
Trait Implementations§
Source§impl Clone for TokioRuntimeExecutor
impl Clone for TokioRuntimeExecutor
Source§fn clone(&self) -> TokioRuntimeExecutor
fn clone(&self) -> TokioRuntimeExecutor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TokioRuntimeExecutor
impl Debug for TokioRuntimeExecutor
Source§impl Executor for TokioRuntimeExecutor
impl Executor for TokioRuntimeExecutor
Source§fn runtime_type(&self) -> Option<&'static str>
fn runtime_type(&self) -> Option<&'static str>
Source§fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
JoinHandle for it.Source§fn spawn_abortable<F>(&self, future: F) -> AbortableJoinHandle<F::Output> ⓘ
fn spawn_abortable<F>(&self, future: F) -> AbortableJoinHandle<F::Output> ⓘ
Source§fn dispatch<F>(&self, future: F)
fn dispatch<F>(&self, future: F)
Executor::spawn.Source§fn spawn_coroutine<T, F, Fut>(&self, f: F) -> CommunicationTask<T>
fn spawn_coroutine<T, F, Fut>(&self, f: F) -> CommunicationTask<T>
Source§fn spawn_coroutine_with_buffer<T, F, Fut>(
&self,
buffer: usize,
f: F,
) -> CommunicationTask<T>
fn spawn_coroutine_with_buffer<T, F, Fut>( &self, buffer: usize, f: F, ) -> CommunicationTask<T>
Source§fn spawn_unbounded_coroutine<T, F, Fut>(
&self,
f: F,
) -> UnboundedCommunicationTask<T>
fn spawn_unbounded_coroutine<T, F, Fut>( &self, f: F, ) -> UnboundedCommunicationTask<T>
Source§fn spawn_coroutine_with_context<T, C, F, Fut>(
&self,
context: C,
f: F,
) -> CommunicationTask<T>
fn spawn_coroutine_with_context<T, C, F, Fut>( &self, context: C, f: F, ) -> CommunicationTask<T>
Source§fn spawn_coroutine_with_buffer_and_context<T, C, F, Fut>(
&self,
context: C,
buffer: usize,
f: F,
) -> CommunicationTask<T>
fn spawn_coroutine_with_buffer_and_context<T, C, F, Fut>( &self, context: C, buffer: usize, f: F, ) -> CommunicationTask<T>
Source§fn spawn_unbounded_coroutine_with_context<T, C, F, Fut>(
&self,
context: C,
f: F,
) -> UnboundedCommunicationTask<T>
fn spawn_unbounded_coroutine_with_context<T, C, F, Fut>( &self, context: C, f: F, ) -> UnboundedCommunicationTask<T>
Source§fn spawn_coroutine_with_receiver<T, F, Fut>(&self, f: F) -> CommunicationTask<T>
fn spawn_coroutine_with_receiver<T, F, Fut>(&self, f: F) -> CommunicationTask<T>
channels.
This function returns a handle that allows sending a message, or if there is no reference to the handle at all
(in other words, all handles are dropped), the task would be aborted.Source§fn spawn_coroutine_with_receiver_and_buffer<T, F, Fut>(
&self,
buffer: usize,
f: F,
) -> CommunicationTask<T>
fn spawn_coroutine_with_receiver_and_buffer<T, F, Fut>( &self, buffer: usize, f: F, ) -> CommunicationTask<T>
channels.
This function returns a handle that allows sending a message, or if there is no reference to the handle at all
(in other words, all handles are dropped), the task would be aborted.Source§fn spawn_coroutine_with_receiver_and_context<T, F, C, Fut>(
&self,
context: C,
f: F,
) -> CommunicationTask<T>
fn spawn_coroutine_with_receiver_and_context<T, F, C, Fut>( &self, context: C, f: F, ) -> CommunicationTask<T>
channels.
This function returns a handle that allows sending a message, or if there is no reference to the handle at all
(in other words, all handles are dropped), the task would be aborted.Source§fn spawn_coroutine_with_receiver_buffer_and_context<T, F, C, Fut>(
&self,
context: C,
buffer: usize,
f: F,
) -> CommunicationTask<T>
fn spawn_coroutine_with_receiver_buffer_and_context<T, F, C, Fut>( &self, context: C, buffer: usize, f: F, ) -> CommunicationTask<T>
channels.
This function returns a handle that allows sending a message, or if there is no reference to the handle at all
(in other words, all handles are dropped), the task would be aborted.Source§fn spawn_unbounded_coroutine_with_receiver<T, F, Fut>(
&self,
f: F,
) -> UnboundedCommunicationTask<T>
fn spawn_unbounded_coroutine_with_receiver<T, F, Fut>( &self, f: F, ) -> UnboundedCommunicationTask<T>
channels.
This function returns a handle that allows sending a message, or if there is no reference to the handle at all
(in other words, all handles are dropped), the task would be aborted.Source§fn spawn_unbounded_coroutine_with_receiver_and_context<T, F, C, Fut>(
&self,
context: C,
f: F,
) -> UnboundedCommunicationTask<T>
fn spawn_unbounded_coroutine_with_receiver_and_context<T, F, C, Fut>( &self, context: C, f: F, ) -> UnboundedCommunicationTask<T>
channels.
This function returns a handle that allows sending a message, or if there is no reference to the handle at all
(in other words, all handles are dropped), the task would be aborted.Source§fn scope<'env, F, T>(&self, f: F) -> impl Future<Output = T>where
F: for<'scope> AsyncFnOnce(&'scope Scope<'scope, 'env>) -> T,
fn scope<'env, F, T>(&self, f: F) -> impl Future<Output = T>where
F: for<'scope> AsyncFnOnce(&'scope Scope<'scope, 'env>) -> T,
Source§fn executor_scope<'scope, F, T>(&'scope self, f: F) -> impl Future<Output = T>
fn executor_scope<'scope, F, T>(&'scope self, f: F) -> impl Future<Output = T>
Source§impl ExecutorBlockOn for TokioRuntimeExecutor
impl ExecutorBlockOn for TokioRuntimeExecutor
Source§fn block_on<F: Future>(&self, f: F) -> F::Output
fn block_on<F: Future>(&self, f: F) -> F::Output
Blocks the current thread until the provided future has completed.
Note that when this executor owns a Runtime, that runtime is driven directly.
When created from a Handle, this delegates to Handle::block_on and
inherits its runtime-specific limitations. See Runtime::block_on and
Handle::block_on for details.
Source§impl ExecutorBlocking for TokioRuntimeExecutor
impl ExecutorBlocking for TokioRuntimeExecutor
Source§fn spawn_blocking<F, R>(&self, f: F) -> JoinHandle<R> ⓘ
fn spawn_blocking<F, R>(&self, f: F) -> JoinHandle<R> ⓘ
Source§fn spawn_blocking_abortable<F, R>(&self, f: F) -> AbortableJoinHandle<R> ⓘ
fn spawn_blocking_abortable<F, R>(&self, f: F) -> AbortableJoinHandle<R> ⓘ
Source§impl ExecutorTimeout for TokioRuntimeExecutor
impl ExecutorTimeout for TokioRuntimeExecutor
Source§fn spawn_timeout<F>(
&self,
duration: Duration,
f: F,
) -> JoinHandle<Result<F::Output, TimeoutError>> ⓘ
fn spawn_timeout<F>( &self, duration: Duration, f: F, ) -> JoinHandle<Result<F::Output, TimeoutError>> ⓘ
duration,
returning a JoinHandle. Read moreSource§fn spawn_delay<F>(&self, duration: Duration, f: F) -> JoinHandle<F::Output> ⓘ
fn spawn_delay<F>(&self, duration: Duration, f: F) -> JoinHandle<F::Output> ⓘ
Source§fn spawn_abortable_timeout<F>(
&self,
duration: Duration,
f: F,
) -> AbortableJoinHandle<Result<F::Output, TimeoutError>> ⓘ
fn spawn_abortable_timeout<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<Result<F::Output, TimeoutError>> ⓘ
duration,
returning an abortable handle that will cancel the task once the handle is dropped. Read more