pub struct WatchdogContext { /* private fields */ }Expand description
Delegated control capability scoped to one exact watchdog work attempt.
Mutation authority expires when the callback completes. Retain the
WatchdogRegistration for longer-lived ownership.
Implementations§
Source§impl WatchdogContext
impl WatchdogContext
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) -> Result<(), TimerError>
pub fn ensure_scheduled(&self) -> Result<(), TimerError>
Request that the pre-armed cadence successor remain scheduled.
This is idempotent unless it supersedes a nested cancellation request. It never arms an additional Watchdog successor and cannot move a pending immediate successor later.
Sourcepub fn ensure_scheduled_immediately(&self) -> Result<(), TimerError>
pub fn ensure_scheduled_immediately(&self) -> Result<(), TimerError>
Request that this work attempt’s pre-armed successor run immediately.
Repeated requests coalesce, and a cadence ensure cannot move the pending immediate deadline later. Normal completion replaces the exact cadence successor with a zero-delay scheduler callback. Consumer work still runs only in the scheduler’s separately queued later message.
Sourcepub fn reconcile_schedule(
&self,
schedule: Option<TimerSchedule>,
) -> Result<(), TimerError>
pub fn reconcile_schedule( &self, schedule: Option<TimerSchedule>, ) -> Result<(), TimerError>
Replace this attempt’s successor with an exact schedule, or cancel it.
Applied on normal completion; a trap preserves the committed cadence successor. The latest reconciliation wins over prior scheduling demand, but unregistration and invariant failure remain terminal.
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 clears the already-armed successor when cancellation wins. A retained declaration becomes inactive; a remove-on-stop declaration is removed.