Struct cros_async::timer::TimerAsync
source · pub struct TimerAsync<T: TimerTrait + IntoAsync> {
pub(crate) io_source: IoSource<T>,
}
Expand description
An async version of base::Timer.
Fields§
§io_source: IoSource<T>
Implementations§
source§impl<T: TimerTrait + IntoAsync> TimerAsync<T>
impl<T: TimerTrait + IntoAsync> TimerAsync<T>
pub async fn wait_sys(&self) -> AsyncResult<()>
source§impl<T: TimerTrait + IntoAsync> TimerAsync<T>
impl<T: TimerTrait + IntoAsync> TimerAsync<T>
pub fn new(timer: T, ex: &Executor) -> AsyncResult<TimerAsync<T>>
sourcepub async fn wait(&self) -> AsyncResult<()>
pub async fn wait(&self) -> AsyncResult<()>
Gets the next value from the timer.
NOTE: on Windows, this may return/wake early. See base::Timer
docs
for details.
sourcepub fn reset_oneshot(&mut self, dur: Duration) -> SysResult<()>
pub fn reset_oneshot(&mut self, dur: Duration) -> SysResult<()>
Sets the timer to expire after dur
. Cancels any existing timer.
sourcepub fn reset_repeating(&mut self, dur: Duration) -> SysResult<()>
pub fn reset_repeating(&mut self, dur: Duration) -> SysResult<()>
Sets the timer to expire repeatedly at intervals of dur
. Cancels any existing timer.
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TimerAsync<T>
impl<T> Send for TimerAsync<T>
impl<T> Sync for TimerAsync<T>where
T: Sync,
impl<T> Unpin for TimerAsync<T>where
T: Unpin,
impl<T> !UnwindSafe for TimerAsync<T>
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