pub type TokioRuntime = Runtime<Tokio>;Expand description
Type alias for the tokio runtime
Aliased Type§
pub struct TokioRuntime { /* private fields */ }Implementations§
Source§impl TokioRuntime
impl TokioRuntime
Sourcepub fn tokio() -> Result<Self>
pub fn tokio() -> Result<Self>
Create a new TokioRuntime backed by a freshly created tokio multi-threaded runtime.
Sourcepub fn tokio_current() -> Self
pub fn tokio_current() -> Self
Create a new TokioRuntime and bind it to the current tokio runtime by default.
Sourcepub fn tokio_with_handle(handle: Handle) -> Self
pub fn tokio_with_handle(handle: Handle) -> Self
Create a new TokioRuntime and bind it to the tokio runtime associated to this handle by default.
Sourcepub fn tokio_with_runtime(runtime: TokioRT) -> Self
pub fn tokio_with_runtime(runtime: TokioRT) -> Self
Create a new TokioRuntime and bind it to this tokio runtime.
Sourcepub fn shutdown_blocking(self) -> Result<(), Self>
pub fn shutdown_blocking(self) -> Result<(), Self>
Shut down the owned Tokio runtime, waiting for its blocking tasks to finish.
Returns the runtime unchanged if another clone still owns it or this is called from a
Tokio task, including a spawn_blocking task. A runtime bound only to a handle has no
owned runtime to shut down and returns Ok(()).
Unlike dropping the last owner, this waits even if a Tokio handle was entered on a plain thread. Call it from an ordinary thread, not from a runtime worker or an active async executor.
§Panics
Tokio panics if a runtime is shut down with a blocking wait inside an async executor
without a Tokio task ID, such as a top-level Handle::block_on call. Calls from Tokio
tasks instead return Err(self).