pub struct TokioIoExecutorService { /* private fields */ }Expand description
Tokio-backed executor service for async IO and Future-based tasks.
Accepted futures are spawned with tokio::spawn, so waiting for external
IO does not occupy a dedicated blocking thread.
Implementations§
Source§impl TokioIoExecutorService
impl TokioIoExecutorService
Sourcepub fn spawn<F, R, E>(
&self,
future: F,
) -> Result<TokioTaskHandle<R, E>, RejectedExecution>
pub fn spawn<F, R, E>( &self, future: F, ) -> Result<TokioTaskHandle<R, E>, RejectedExecution>
Accepts an async task and spawns it on the current Tokio runtime.
§Parameters
future- Future to execute on Tokio’s async scheduler.
§Returns
A TokioTaskHandle for the accepted task.
§Errors
Returns RejectedExecution::Shutdown if shutdown has already been
requested before the task is accepted.
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Stops accepting new async tasks.
Already accepted tasks are allowed to finish unless aborted through
their handles or by Self::shutdown_now.
Sourcepub fn shutdown_now(&self) -> ShutdownReport
pub fn shutdown_now(&self) -> ShutdownReport
Stops accepting new tasks and aborts tracked async tasks.
§Returns
A report with zero queued tasks, the observed active-task count, and the number of Tokio abort handles signalled.
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Returns whether shutdown has been requested.
§Returns
true if this service no longer accepts new async tasks.
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Returns whether shutdown was requested and all async tasks are finished.
§Returns
true only after shutdown has been requested and no accepted async
tasks remain active.
Trait Implementations§
Source§impl Clone for TokioIoExecutorService
impl Clone for TokioIoExecutorService
Source§fn clone(&self) -> TokioIoExecutorService
fn clone(&self) -> TokioIoExecutorService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more