Struct calloop::timer::Timer [−][src]
pub struct Timer<T> { /* fields omitted */ }A Timer event source
It generates events of type (T, TimerHandle<T>), providing you
an handle inside the event callback, allowing you to set new timeouts
as a response to a timeout being reached (for reccuring ticks for example).
Methods
impl<T> Timer<T>[src]
impl<T> Timer<T>pub fn new() -> Timer<T>[src]
pub fn new() -> Timer<T>Create a new timer with default parameters
Default time resolution is 100ms
pub fn with_resolution(resolution: Duration) -> Timer<T>[src]
pub fn with_resolution(resolution: Duration) -> Timer<T>Create a new timer with a specific time resolution
pub fn handle(&self) -> TimerHandle<T>[src]
pub fn handle(&self) -> TimerHandle<T>Get an handle for this timer
Trait Implementations
impl<T> Evented for Timer<T>[src]
impl<T> Evented for Timer<T>fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>[src]
fn register(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>Register self with the given Poll instance. Read more
fn reregister(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>[src]
fn reregister(
&self,
poll: &Poll,
token: Token,
interest: Ready,
opts: PollOpt
) -> Result<()>Re-register self with the given Poll instance. Read more
fn deregister(&self, poll: &Poll) -> Result<()>[src]
fn deregister(&self, poll: &Poll) -> Result<()>Deregister self from the given Poll instance Read more
impl<T: 'static> EventSource for Timer<T>[src]
impl<T: 'static> EventSource for Timer<T>type Event = (T, TimerHandle<T>)
The type of events generated by your sources
fn interest(&self) -> Ready[src]
fn interest(&self) -> ReadyThe interest value that will be given to mio when registering your source
fn pollopts(&self) -> PollOpt[src]
fn pollopts(&self) -> PollOptThe pollopt value that will be given to mio when registering your source
fn make_dispatcher<Data: 'static, F: FnMut((T, TimerHandle<T>), &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>[src]
fn make_dispatcher<Data: 'static, F: FnMut((T, TimerHandle<T>), &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>Wrap an user callback into a dispatcher, that will convert an mio readiness into an event Read more