pub struct TimerHandle { /* private fields */ }Available on crate feature
libuv only.Expand description
Binding to libuv’s Timer handle used to schedule callbacks to be called in the future.
Implementations§
Source§impl TimerHandle
impl TimerHandle
Sourcepub fn start<Cb, R>(
timeout: Duration,
repeat: Duration,
callback: Cb,
) -> Result<TimerHandle, Error>where
Cb: FnMut(&mut TimerHandle) -> R + 'static,
R: IntoResult<()>,
<R as IntoResult<()>>::Error: Error + 'static,
pub fn start<Cb, R>(
timeout: Duration,
repeat: Duration,
callback: Cb,
) -> Result<TimerHandle, Error>where
Cb: FnMut(&mut TimerHandle) -> R + 'static,
R: IntoResult<()>,
<R as IntoResult<()>>::Error: Error + 'static,
Executes a callback every repeat interval starting after timeout.
If the timeout is zero the callback will fire on the next event loop iteration.
Sourcepub fn once<Cb, R>(
timeout: Duration,
callback: Cb,
) -> Result<TimerHandle, Error>where
Cb: FnOnce() -> R + 'static,
R: IntoResult<()>,
<R as IntoResult<()>>::Error: Error + 'static,
pub fn once<Cb, R>(
timeout: Duration,
callback: Cb,
) -> Result<TimerHandle, Error>where
Cb: FnOnce() -> R + 'static,
R: IntoResult<()>,
<R as IntoResult<()>>::Error: Error + 'static,
Same as start() but accepts a closure that
will be called once before being automatically stopped.
Auto Trait Implementations§
impl Freeze for TimerHandle
impl !RefUnwindSafe for TimerHandle
impl !Send for TimerHandle
impl !Sync for TimerHandle
impl Unpin for TimerHandle
impl !UnwindSafe for TimerHandle
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§type Error = Infallible
type Error = Infallible
The error type in the returned
Result.Source§fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Error>
Converts the value into a
Result.