pub trait TimerOps:
Send
+ Sync
+ 'static {
// Required methods
fn start(
&self,
current_task: &CurrentTask,
source: Option<Weak<dyn OnWakeOps>>,
deadline: TargetTime,
) -> Result<(), Errno>;
fn stop(&self, kernel: &Arc<Kernel>) -> Result<(), Errno>;
fn as_handle_ref(&self) -> HandleRef<'_>;
fn get_timeline_change_observer(
&self,
current_task: &CurrentTask,
) -> Option<TimelineChangeObserver>;
}Required Methods§
Sourcefn start(
&self,
current_task: &CurrentTask,
source: Option<Weak<dyn OnWakeOps>>,
deadline: TargetTime,
) -> Result<(), Errno>
fn start( &self, current_task: &CurrentTask, source: Option<Weak<dyn OnWakeOps>>, deadline: TargetTime, ) -> Result<(), Errno>
Starts the timer with the specified deadline.
This method should start the timer and schedule it to trigger at the specified deadline.
The timer should be cancelled if it is already running.
Sourcefn stop(&self, kernel: &Arc<Kernel>) -> Result<(), Errno>
fn stop(&self, kernel: &Arc<Kernel>) -> Result<(), Errno>
Stops the timer.
This method should stop the timer and prevent it from triggering.
Sourcefn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
Returns a reference to the underlying Zircon handle.
Sourcefn get_timeline_change_observer(
&self,
current_task: &CurrentTask,
) -> Option<TimelineChangeObserver>
fn get_timeline_change_observer( &self, current_task: &CurrentTask, ) -> Option<TimelineChangeObserver>
For TimerOps that support monitoring timeline changes (e.g. timers on the UTC timeline), this returns a an object that counts the number of timeline changes since last reset.
The caller must reset this value to restart the counting.