Enum fuse_backend_rs::common::async_runtime::Runtime
source · Expand description
An adapter enum to support both tokio current-thread Runtime and tokio-uring Runtime.
Variants§
Implementations§
source§impl Runtime
impl Runtime
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance of async Runtime.
A tokio-uring::Runtime
is create if io-uring is available, otherwise a tokio current
thread Runtime will be created.
Panic
Panic if failed to create the Runtime object.
sourcepub fn spawn<T: Future + 'static>(&self, task: T) -> JoinHandle<T::Output>
pub fn spawn<T: Future + 'static>(&self, task: T) -> JoinHandle<T::Output>
Spawns a new asynchronous task, returning a JoinHandle
for it.
Spawning a task enables the task to execute concurrently to other tasks. There is no guarantee that a spawned task will execute to completion. When a runtime is shutdown, all outstanding tasks are dropped, regardless of the lifecycle of that task.
This function must be called from the context of a tokio-uring
runtime.