pi_async_executor/timer/
protocol.rs1use pi_async_runtime_core::{
3 definitions::RuntimeId,
4 time::{TimerAccess, TimerEntry},
5};
6use pi_async_task_queue::{
7 management::QueueCleanupProgress,
8 timer::{TimerSubmitError, TimerTaskQueue},
9};
10use pi_clock_manual::global::GlobalManualInstant;
11
12pub trait LocalTimerSubmit<Item>: 'static {
17 fn try_push_local(
18 runtime: RuntimeId,
19 deadline: GlobalManualInstant,
20 item: Item,
21 ) -> pi_result::RawResult<pi_async_task_queue::CancelTimerKey, TimerSubmitError<Item>>;
22}
23
24pub trait ExecutorTimer:
29 TimerTaskQueue<
30 Item = TimerEntry<
31 <Self as TimerTaskQueue>::Key,
32 <<Self as ExecutorTimer>::Access as TimerAccess>::Registration,
33 >,
34>
35{
36 type Access: TimerAccess<
37 Instant = <Self as TimerTaskQueue>::Instant,
38 Key = <Self as TimerTaskQueue>::Key,
39 >;
40 fn timer_access(&self) -> Self::Access;
41 fn process_cancel_retries(&mut self) -> pi_result::Result<QueueCleanupProgress>;
43}