Skip to main content

pi_async_runtime/
current.rs

1//! 当前公开访问接口(API)的聚合实现;本地设施操作另归access。
2use crate::{instance::*, mode::RuntimeMode};
3use pi_async_executor::{ExecutorClock, ExecutorHooks, IdlePolicy};
4use pi_async_runtime_core::RuntimeContext;
5use pi_clock_manual::global::GlobalManualInstant;
6impl<C: ExecutorClock<Instant = GlobalManualInstant>> RuntimeContext for RuntimeHandle<C> {
7    type Handle = Self;
8    fn handle(&self) -> Self {
9        self.clone()
10    }
11}
12impl<M, C, P, H> RuntimeContext for ConfiguredRuntime<M, C, P, H>
13where
14    M: RuntimeMode,
15    C: ExecutorClock<Instant = GlobalManualInstant>,
16    P: IdlePolicy,
17    H: ExecutorHooks,
18{
19    type Handle = RuntimeHandle<C>;
20    fn handle(&self) -> RuntimeHandle<C> {
21        self.shared.clone()
22    }
23}