pub trait AsyncRuntimeExt<O: Default + 'static = ()> {
// Required methods
fn spawn_with_context<F, C>(
&self,
task_id: TaskId,
future: F,
context: C,
) -> Result<()>
where F: Future<Output = O> + 'static,
C: 'static;
fn spawn_timing_with_context<F, C>(
&self,
task_id: TaskId,
future: F,
context: C,
time: usize,
) -> Result<()>
where F: Future<Output = O> + 'static,
C: 'static;
fn block_on<F>(&self, future: F) -> Result<F::Output>
where F: Future + 'static,
<F as Future>::Output: Default + 'static;
}Expand description
顺序执行的异步运行时扩展
Required Methods§
Sourcefn spawn_with_context<F, C>(
&self,
task_id: TaskId,
future: F,
context: C,
) -> Result<()>where
F: Future<Output = O> + 'static,
C: 'static,
fn spawn_with_context<F, C>(
&self,
task_id: TaskId,
future: F,
context: C,
) -> Result<()>where
F: Future<Output = O> + 'static,
C: '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.