Skip to main content

DefaultTimerAccess

Struct DefaultTimerAccess 

Source
pub struct DefaultTimerAccess<C: ExecutorClock<Instant = GlobalManualInstant>, L: 'static> { /* private fields */ }
Expand description

同一计时来源的Clone+Send+Sync访问;不保本地容器或可写线程局部指针。

正常业务通过运行时(runtime)的timeout/sleep等使用。C为同源时钟,L为静态本地接入; 外部签名不要求业务Future的Unpin或额外Sync,最终运行时别名隐藏这两个实现参数。

Trait Implementations§

Source§

impl<C: ExecutorClock<Instant = GlobalManualInstant>, L: 'static> Clone for DefaultTimerAccess<C, L>

Source§

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
Source§

impl<C, L> TimerAccess for DefaultTimerAccess<C, L>

Source§

type Instant = GlobalManualInstant

Source§

type Key = CancelTimerKey

Source§

type Registration = DefaultTimerRegistration<C, L>

Source§

fn runtime_id(&self) -> RuntimeId

读取同一原逻辑服务的身份;不赋予来源管理或执行权限。
Source§

fn deadline_after( &self, duration: Duration, ) -> RawResult<Self::Instant, TimerError>

真实取当前单调时间一次并检查相加;不以无新鲜度保证的旧样本导致提前到期。
Source§

fn prepare_registration( &self, kind: TimerRegistrationKind, ) -> RawResult<Self::Registration, TimerError>

一次准备共享登记与必要重试存储;失败保原报告(Report),不取时、不入队、不创建Task。
Source§

fn try_register( &self, deadline: Self::Instant, item: DefaultTimerItem<C, L>, ) -> RawResult<Self::Key, TimerSubmitError<DefaultTimerItem<C, L>>>

线程安全(thread-safe)尝试接收原登记;明确拒绝返还同一TimerEntry,接受后异常由真实参与者接续,不伪装拒绝。
Source§

fn try_register_local( &self, deadline: Self::Instant, item: DefaultTimerItem<C, L>, ) -> RawResult<Self::Key, TimerSubmitError<DefaultTimerItem<C, L>>>

仅当前合法所属线程可用;错误必须返还原值,本地载荷不额外要求Send/Sync。
Source§

fn request_cancel(&self, key: &Self::Key) -> RawResult<(), TimerQueueError>

以同源键(key)记录或合并取消请求;Ok不证明登记存在、已移除或任务(Task)已清理。
Source§

fn defer_cancel( &self, registration: Self::Registration, error: Option<TimerQueueError>, )

接管同一取消责任和可选原错误,不失败、不等待、不新增Task或每次重试分配。 实际服务通过resume_timer_cancel有限处理,关闭/拥有者退出仍须保有真实接续者。

Auto Trait Implementations§

§

impl<C, L> !RefUnwindSafe for DefaultTimerAccess<C, L>

§

impl<C, L> !UnwindSafe for DefaultTimerAccess<C, L>

§

impl<C, L> Forget for DefaultTimerAccess<C, L>

§

impl<C, L> Freeze for DefaultTimerAccess<C, L>
where Arc<TimerSourceShared<C, L>>: Freeze,

§

impl<C, L> Move for DefaultTimerAccess<C, L>

§

impl<C, L> Send for DefaultTimerAccess<C, L>
where Arc<TimerSourceShared<C, L>>: Send,

§

impl<C, L> Sync for DefaultTimerAccess<C, L>
where Arc<TimerSourceShared<C, L>>: Sync,

§

impl<C, L> Unpin for DefaultTimerAccess<C, L>
where Arc<TimerSourceShared<C, L>>: Unpin,

§

impl<C, L> UnsafeUnpin for DefaultTimerAccess<C, L>
where Arc<TimerSourceShared<C, L>>: UnsafeUnpin,

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.