Skip to main content

ManualClock

Struct ManualClock 

pub struct ManualClock;
Expand description

默认全局手推时钟(manual clock)的零大小访问能力,支持Copy+Clone。

Self::new核对外部已经安装的同一进程全局实例,不安装或重置已有起点。每次ExecutorClock::now 通过pi_clock_manual实际刷新,不把try_now的无新鲜度保证缓存用作新截止时间的起点。 外部须先按pi_clock的公开初始化接口准备全局时间轴;本库不接管进程全局安装责任。 正常访问不创建运行时(runtime)或线程,也不为接入增加同步保护。

Implementations§

§

impl ManualClock

pub fn new() -> Result<Self>

核对原全局时间轴已安装;未安装及其它原报告原样返回,不隐式初始化或等待。

Trait Implementations§

§

impl Clone for ManualClock

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for ManualClock

§

impl Debug for ManualClock

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl ExecutorClock for ManualClock

§

type Instant = GlobalManualInstant

与接入的定时来源相同的时间点(time point);不要求Copy、Ord、Sync或Unpin。
§

fn now(&self) -> Result<Self::Instant>

一次真实采样并采用同源单调结果;原失败报告(Report)原样返回。
§

fn checked_add( &self, now: &Self::Instant, duration: Duration, ) -> Result<Self::Instant>

对显式原时刻受检相加;不再次采样,不在越界时回绕或饱和成正常截止。
§

fn remaining( &self, now: &Self::Instant, deadline: &Self::Instant, ) -> Result<Duration>

计算到显式截止的剩余时长;已到或已过返回零,不再次取时。 输入必须来自同一时间轴;实现可报告不能验证或越界的输入。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OpaqueAttachment for T
where T: Send + Sync + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.