Struct dharma::timer::Timer
[−]
[src]
pub struct Timer<F> where
F: FnMut() -> (), { /* fields omitted */ }
General purpose timer implementing EventHandler
.
Methods
impl<F> Timer<F> where
F: FnMut() -> (),
[src]
F: FnMut() -> (),
fn new(interval: Duration, callback: F) -> Result<Self, ()>
Constructs new Timer
expiring periodically with given interval and calling given
callback
.
Trait Implementations
impl<F> EventHandler for Timer<F> where
F: FnMut() -> (),
[src]
F: FnMut() -> (),
fn get_fd(&self) -> RawFd
Returns file descriptor.
fn process_event(&mut self, event_kind: EventKind)
Callback function executed on event received.
fn set_id(&mut self, _id: EventHandlerId)
This method is called by Dispatcher
right after adding this EventHandler
. Passed value is newly assigned ID of EventHandler
which can be later used to delete it from Dispatcher
. Read more