pi-async-runtime 0.1.5

单线程串行及并发异步运行时的静态组合
Documentation
fn local_runtime_new_inner(options: ExecutorOptions) -> pi_result::Result<LocalRuntime> {
    let binding = RuntimeBinding::new();
    let revoke = Rc::clone(&binding);
    let executor =
        DefaultExecutor::with_local_task_queue(ManualClock, options, move || revoke.revoke())?;
    let local = Rc::clone(executor.local());
    let service = LocalService::from_local_executor(executor, binding);
    Ok(LocalRuntime { service, local })
}

fn local_runtime_with_queues_inner<I, F, T>(
    options: ExecutorOptions,
    queues: LocalRuntimeQueues<I, F>,
) -> pi_result::Result<ConfiguredLocalRuntime<I, T>>
where
    I: IdleBinding,
    T: TimerBinding<ClockInstant = GlobalManualInstant>,
    F: RuntimeTimerFactory<ManualClock, T, Ready>,
{
    let clock = if T::PRESENT { ManualClock::new()? } else { ManualClock };
    let binding = RuntimeBinding::new();
    let revoke = Rc::clone(&binding);
    let (idle, timer) = queues.into_parts();
    let executor = DefaultExecutor::with_local_queues(
        clock,
        idle,
        options,
        timer.prepare(Default::default()),
        move || revoke.revoke(),
    )?;
    let local = Rc::clone(executor.local());
    let service = LocalService::from_local_executor(executor, binding);
    Ok(ConfiguredLocalRuntime { service, local })
}