pub trait RuntimeTrait {
// Required methods
fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
where F: Future + Send + 'static,
F::Output: Send + 'static;
fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> ⓘ
where F: FnOnce() -> R + Send + 'static,
R: Send + 'static;
fn block_on<F: Future>(&self, future: F) -> F::Output;
fn name(&self) -> &str;
// Provided method
fn builder() -> Builder { ... }
}
Required Methods§
sourcefn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
fn spawn<F>(&self, future: F) -> JoinHandle<F::Output> ⓘ
Spawn a future and execute it in this thread pool
Similar to tokio::runtime::Runtime::spawn()
sourcefn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> ⓘ
fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> ⓘ
Run the provided function on an executor dedicated to blocking operations.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.