pub struct Timer(/* private fields */);Expand description
An object representing a Magenta event pair.
As essentially a subtype of Handle, it can be freely interconverted.
Implementations§
Source§impl Timer
impl Timer
Sourcepub fn create(options: TimerOpts, clock_id: ClockId) -> Result<Timer, Status>
pub fn create(options: TimerOpts, clock_id: ClockId) -> Result<Timer, Status>
Create a timer, an object that can signal when a specified point in time has been reached. Wraps the mx_timer_create syscall.
Sourcepub fn start(
&self,
deadline: mx_time_t,
period: mx_duration_t,
slack: mx_duration_t,
) -> Result<(), Status>
pub fn start( &self, deadline: mx_time_t, period: mx_duration_t, slack: mx_duration_t, ) -> Result<(), Status>
Starts a timer which will fire when deadline passes. Wraps the
mx_timer_start
syscall.
Sourcepub fn set(
&self,
deadline: mx_time_t,
slack: mx_duration_t,
) -> Result<(), Status>
pub fn set( &self, deadline: mx_time_t, slack: mx_duration_t, ) -> Result<(), Status>
Start a one-shot timer that will fire when deadline passes. Wraps the
mx_timer_set
syscall.
Trait Implementations§
Source§impl AsHandleRef for Timer
impl AsHandleRef for Timer
Source§fn as_handle_ref(&self) -> HandleRef<'_>
fn as_handle_ref(&self) -> HandleRef<'_>
Get a reference to the handle. One important use of such a reference is
for
object_wait_many.Source§fn raw_handle(&self) -> mx_handle_t
fn raw_handle(&self) -> mx_handle_t
Interpret the reference as a raw handle (an integer type). Two distinct
handles will have different raw values (so it can perhaps be used as a
key in a data structure).
Source§fn signal_handle(
&self,
clear_mask: Signals,
set_mask: Signals,
) -> Result<(), Status>
fn signal_handle( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>
Set and clear userspace-accessible signal bits on an object. Wraps the
mx_object_signal
syscall.
Source§fn wait_handle(
&self,
signals: Signals,
deadline: mx_time_t,
) -> Result<Signals, Status>
fn wait_handle( &self, signals: Signals, deadline: mx_time_t, ) -> Result<Signals, Status>
Waits on a handle. Wraps the
mx_object_wait_one
syscall.
Source§fn wait_async_handle(
&self,
port: &Port,
key: u64,
signals: Signals,
options: WaitAsyncOpts,
) -> Result<(), Status>
fn wait_async_handle( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>
Causes packet delivery on the given port when the object changes state and matches signals.
mx_object_wait_async
syscall.
Source§impl HandleBased for Timer
impl HandleBased for Timer
Source§fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
fn duplicate_handle(&self, rights: Rights) -> Result<Self, Status>
Duplicate a handle, possibly reducing the rights available. Wraps the
mx_handle_duplicate
syscall.
Source§fn replace_handle(self, rights: Rights) -> Result<Self, Status>
fn replace_handle(self, rights: Rights) -> Result<Self, Status>
Create a replacement for a handle, possibly reducing the rights available. This invalidates
the original handle. Wraps the
mx_handle_replace
syscall.
impl Eq for Timer
impl StructuralPartialEq for Timer
Auto Trait Implementations§
impl Freeze for Timer
impl RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl UnwindSafe for Timer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more