[−][src]Struct libuv::handles::timer::TimerHandle
Timer handles are used to schedule callbacks to be called in the future.
Implementations
impl TimerHandle
[src]
pub fn new(r#loop: &Loop) -> Result<TimerHandle>
[src]
Create and initialize a new timer handle
pub fn start<CB: Into<TimerCB<'static>>>(
&mut self,
timeout: u64,
repeat: u64,
cb: CB
) -> Result<()>
[src]
&mut self,
timeout: u64,
repeat: u64,
cb: CB
) -> Result<()>
Start the timer. timeout and repeat are in milliseconds.
If timeout is zero, the callback fires on the next event loop iteration. If repeat is non-zero, the callback fires first after timeout milliseconds and then repeatedly after repeat milliseconds.
Note: Does not update the event loop’s concept of “now”. See Loop.update_time() for more information.
If the timer is already active, it is simply updated.
pub fn stop(&mut self) -> Result<()>
[src]
Stop the timer, the callback will not be called anymore.
pub fn again(&mut self) -> Result<()>
[src]
Stop the timer, and if it is repeating restart it using the repeat value as the timeout. If the timer has never been started before it returns EINVAL.
pub fn set_repeat(&mut self, repeat: u64)
[src]
Set the repeat interval value in milliseconds. The timer will be scheduled to run on the given interval, regardless of the callback execution duration, and will follow normal timer semantics in the case of a time-slice overrun.
For example, if a 50ms repeating timer first runs for 17ms, it will be scheduled to run again 33ms later. If other tasks consume more than the 33ms following the first timer callback, then the callback will run as soon as possible.
Note: If the repeat value is set from a timer callback it does not immediately take effect. If the timer was non-repeating before, it will have been stopped. If it was repeating, then the old repeat value will have been used to schedule the next timeout.
pub fn get_repeat(&self) -> u64
[src]
Get the timer repeat value.
Trait Implementations
impl Clone for TimerHandle
[src]
fn clone(&self) -> TimerHandle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for TimerHandle
[src]
impl From<TimerHandle> for Handle
[src]
fn from(timer: TimerHandle) -> Handle
[src]
impl HandleTrait for TimerHandle
[src]
fn is_active(&self) -> bool
[src]
fn is_closing(&self) -> bool
[src]
fn close<CB: Into<CloseCB<'static>>>(&mut self, cb: CB)
[src]
fn ref(&mut self)
[src]
fn unref(&mut self)
[src]
fn has_ref(&self) -> bool
[src]
fn send_buffer_size(&mut self, value: i32) -> Result<i32>
[src]
fn recv_buffer_size(&mut self, value: i32) -> Result<i32>
[src]
fn get_fileno(&self) -> Result<OsFile>
[src]
fn get_loop(&self) -> Loop
[src]
fn get_type(&self) -> HandleType
[src]
impl ToHandle for TimerHandle
[src]
impl TryFrom<Handle> for TimerHandle
[src]
Auto Trait Implementations
impl RefUnwindSafe for TimerHandle
impl !Send for TimerHandle
impl !Sync for TimerHandle
impl Unpin for TimerHandle
impl UnwindSafe for TimerHandle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,