pub trait VirtualTaskManagerExt {
// Required methods
fn spawn_and_block_on<A>(
&self,
task: impl Future<Output = A> + Send + 'static,
) -> Result<A, Error>
where A: Send + 'static;
fn spawn_await<O, F>(
&self,
f: F,
) -> Box<dyn Future<Output = Result<O, Box<dyn Error>>> + Unpin + Send + 'static>
where O: Send + 'static,
F: FnOnce() -> O + Send + 'static;
}
Expand description
Generic utility methods for VirtualTaskManager
Required Methods§
Sourcefn spawn_and_block_on<A>(
&self,
task: impl Future<Output = A> + Send + 'static,
) -> Result<A, Error>where
A: Send + 'static,
fn spawn_and_block_on<A>(
&self,
task: impl Future<Output = A> + Send + 'static,
) -> Result<A, Error>where
A: Send + 'static,
Runs the work in the background via the task managers shared background threads while blocking the current execution until it finishs
fn spawn_await<O, F>( &self, f: F, ) -> Box<dyn Future<Output = Result<O, Box<dyn Error>>> + Unpin + Send + 'static>
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.