pi-async-runtime 0.1.5

单线程串行及并发异步运行时的静态组合
Documentation
#[allow(unused_variables)]
fn serial_admit_inner(state: &AdmissionState) -> bool {
    state.status == pi_async_runtime_core::RuntimeStatus::Open
        && state.in_flight_tasks == 0
        && state.internal_tasks == 0
}

fn serial_validate_external_inner<E: ExternalQueueManager + 'static, Q: InternalTaskQueue + 'static>() -> pi_result::Result<()> {
    use std::any::TypeId;

    if TypeId::of::<E>() != TypeId::of::<MpscTaskQueue>() {
        return Err(pi_result::Error::new(pi_result::ErrorKind::InvalidInput)
            .attach("外部任务队列(external task queue)类型不匹配,独立 SerialRuntime 只接收 MpscTaskQueue 与 TaskQueue 的固定组合"));
    }
    if TypeId::of::<Q>() != TypeId::of::<TaskQueue>() {
        return Err(pi_result::Error::new(pi_result::ErrorKind::InvalidInput)
            .attach("内部任务队列(internal task queue)类型不匹配,独立 SerialRuntime 只接收 MpscTaskQueue 与 TaskQueue 的固定组合"));
    }
    Ok(())
}