Trait ExecutorClock
pub trait ExecutorClock:
Clone
+ Send
+ Sync
+ 'static {
type Instant: Send + 'static;
// Required methods
fn now(&self) -> Result<Self::Instant, Report<ErrorKind>>;
fn checked_add(
&self,
now: &Self::Instant,
duration: Duration,
) -> Result<Self::Instant, Report<ErrorKind>>;
fn remaining(
&self,
now: &Self::Instant,
deadline: &Self::Instant,
) -> Result<Duration, Report<ErrorKind>>;
}Expand description
一份逻辑时间轴;克隆(Clone)不得改变起点或产生另一份独立时间。
正常取时不推进任何任务(Task)或队列。实际系统取时和竞争成本由实现说明; 不以旧缓存冒充新鲜时间,不用时钟值代替业务数据的同步。
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".