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 new() -> TokioIoExecutorService
pub fn new() -> 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 moreSource§impl Default for TokioIoExecutorService
impl Default for TokioIoExecutorService
Source§fn default() -> TokioIoExecutorService
fn default() -> TokioIoExecutorService
Auto Trait Implementations§
impl Freeze for TokioIoExecutorService
impl RefUnwindSafe for TokioIoExecutorService
impl Send for TokioIoExecutorService
impl Sync for TokioIoExecutorService
impl Unpin for TokioIoExecutorService
impl UnsafeUnpin for TokioIoExecutorService
impl UnwindSafe for TokioIoExecutorService
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more