pub struct VmTimerPeriodic { /* private fields */ }
Expand description
An abstraction over VmTimeAccess
that streamlines the process of setting
up a periodic timer.
Implementations§
Source§impl VmTimerPeriodic
impl VmTimerPeriodic
Sourcepub fn new(vmtime_access: VmTimeAccess) -> Self
pub fn new(vmtime_access: VmTimeAccess) -> Self
Create a new periodic timer, backed by the given VmTimeAccess
.
Sourcepub fn start(&mut self, period: Duration)
pub fn start(&mut self, period: Duration)
Start the timer, configuring it to fire at the specified period.
If the timer is currently running, the timer will be cancelled + restarted.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the timer is currently running.
Sourcepub fn poll_timeout(&mut self, cx: &mut Context<'_>) -> Poll<VmTime>
pub fn poll_timeout(&mut self, cx: &mut Context<'_>) -> Poll<VmTime>
Polls the timer.
Returns Poll::Ready(now)
when the timer is past-due, returning
Poll::Pending
otherwise.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VmTimerPeriodic
impl !RefUnwindSafe for VmTimerPeriodic
impl Send for VmTimerPeriodic
impl Sync for VmTimerPeriodic
impl Unpin for VmTimerPeriodic
impl !UnwindSafe for VmTimerPeriodic
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