pub struct OnceContext { /* private fields */ }Expand description
Delegated control capability scoped to one exact Once work attempt.
Identity remains inspectable after work returns, but mutation methods then
return TimerError::RegistrationExpired. Retain the
OnceRegistration for longer-lived ownership.
Implementations§
Source§impl OnceContext
impl OnceContext
Sourcepub const fn identity(&self) -> &TimerIdentity
pub const fn identity(&self) -> &TimerIdentity
Return the logical timer identity executing this work.
Sourcepub fn ensure_scheduled(
&self,
schedule: TimerSchedule,
) -> Result<(), TimerError>
pub fn ensure_scheduled( &self, schedule: TimerSchedule, ) -> Result<(), TimerError>
Schedule a Once declaration while this exact work attempt is active.
A context retained after its callback completes is expired and returns
TimerError::RegistrationExpired.
Sourcepub fn reconcile_schedule(
&self,
schedule: Option<TimerSchedule>,
) -> Result<(), TimerError>
pub fn reconcile_schedule( &self, schedule: Option<TimerSchedule>, ) -> Result<(), TimerError>
Reconcile the executing declaration to one exact schedule.
None requests inactive state at normal completion. Retained callback
authority remains; a remove-on-stop declaration is removed when that
cancellation wins arbitration. A stored context cannot mutate the
registration after its exact work attempt ends.
Sourcepub fn cancel(&self) -> Result<(), TimerError>
pub fn cancel(&self) -> Result<(), TimerError>
Request cancellation while this exact work attempt is active.
Cancellation does not interrupt the current invocation; normal completion applies it before any callback successor is retained. A retained declaration becomes inactive. A remove-on-stop declaration is removed when cancellation wins arbitration.