pub struct TokioExecutorService { /* private fields */ }Expand description
Implementations§
Trait Implementations§
Source§impl Clone for TokioExecutorService
impl Clone for TokioExecutorService
Source§fn clone(&self) -> TokioExecutorService
fn clone(&self) -> TokioExecutorService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for TokioExecutorService
impl Default for TokioExecutorService
Source§fn default() -> TokioExecutorService
fn default() -> TokioExecutorService
Source§impl ExecutorService for TokioExecutorService
impl ExecutorService for TokioExecutorService
Source§fn submit<T, E>(&self, task: T) -> Result<(), SubmissionError>
fn submit<T, E>(&self, task: T) -> Result<(), SubmissionError>
Accepts a runnable and runs it through Tokio.
§Parameters
task- Runnable to execute on Tokio’s blocking task pool.
§Returns
Ok(()) if the task was accepted.
§Errors
Returns SubmissionError::Shutdown if shutdown has already been
requested before the task is accepted. Returns
SubmissionError::WorkerSpawnFailed if the current thread is not
entered into a Tokio runtime.
Source§fn submit_callable<C, R, E>(
&self,
task: C,
) -> Result<Self::ResultHandle<R, E>, SubmissionError>
fn submit_callable<C, R, E>( &self, task: C, ) -> Result<Self::ResultHandle<R, E>, SubmissionError>
Accepts a callable and runs it through Tokio.
§Parameters
task- Callable to execute on Tokio’s blocking task pool.
§Returns
A TaskHandle for the accepted task.
§Errors
Returns SubmissionError::Shutdown if shutdown has already been
requested before the task is accepted. Returns
SubmissionError::WorkerSpawnFailed if the current thread is not
entered into a Tokio runtime.
Source§fn submit_tracked_callable<C, R, E>(
&self,
task: C,
) -> Result<Self::TrackedHandle<R, E>, SubmissionError>
fn submit_tracked_callable<C, R, E>( &self, task: C, ) -> Result<Self::TrackedHandle<R, E>, SubmissionError>
Accepts a callable and returns an actively tracked handle.
§Parameters
task- Callable to execute on Tokio’s blocking task pool.
§Returns
A TokioBlockingTaskHandle for the accepted task.
§Errors
Returns SubmissionError::Shutdown if shutdown has already been
requested before the task is accepted. Returns
SubmissionError::WorkerSpawnFailed if the current thread is not
entered into a Tokio runtime.
Source§fn shutdown(&self)
fn shutdown(&self)
Stops accepting new tasks.
Already accepted tasks are allowed to finish unless they are cancelled before their blocking closure starts.
Source§fn stop(&self) -> StopReport
fn stop(&self) -> StopReport
Stops accepting new tasks and requests abort for tracked Tokio tasks.
Tokio cannot abort blocking tasks that have already started. Such tasks continue running and keep the service active until their closure returns.
§Returns
A report with queued and running blocking task counts observed when stop was requested, plus the number of queued blocking tasks that were actually cancelled before their blocking closures started.
Source§fn lifecycle(&self) -> ExecutorServiceLifecycle
fn lifecycle(&self) -> ExecutorServiceLifecycle
Returns the current lifecycle state.
Source§fn is_not_running(&self) -> bool
fn is_not_running(&self) -> bool
Returns whether shutdown has been requested.
Source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
Returns whether shutdown was requested and all tasks are finished.
Source§fn wait_termination(&self)
fn wait_termination(&self)
Blocks until the service has terminated.