Struct j2ds::Timer [−][src]
pub struct Timer { /* fields omitted */ }
A periodic timer with rising and falling edges
Methods
impl Timer
[src]
impl Timer
pub fn new(period: u64, offset: u64, duration: u64) -> Timer
[src]
pub fn new(period: u64, offset: u64, duration: u64) -> Timer
Creaste a new timer that activates every period
ticks,
starts at the given offset
timer, and lasts for duration
ticks. The offset and duration must be less than the
period. The duration may be 0, and in that case the timer will
only emit RisingEdge
events
pub fn next_start_time(&self) -> u64
[src]
pub fn next_start_time(&self) -> u64
Get the next tick that will emit a RisingEdge
event
pub fn next_stop_time(&self) -> u64
[src]
pub fn next_stop_time(&self) -> u64
Get the next tick that will emit a FallingEdge
event
pub fn next_event_time(&self) -> u64
[src]
pub fn next_event_time(&self) -> u64
Get the next tick that will produce any TimerEvent
pub fn update(&mut self, time: u64) -> Option<TimerEvent>
[src]
pub fn update(&mut self, time: u64) -> Option<TimerEvent>
Runs the timer until either the given absolute time
is
reached, or until the next event occurs. You should generally
run this function in a loop, as multiple events may have
occured in the time elapsed.
pub fn is_active(&self) -> bool
[src]
pub fn is_active(&self) -> bool
Indicates if the timer is currently between a RisingEdge
and
FallingEdge
event
Trait Implementations
impl Debug for Timer
[src]
impl Debug for Timer
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for Timer
[src]
impl Eq for Timer
impl PartialEq for Timer
[src]
impl PartialEq for Timer
fn eq(&self, other: &Timer) -> bool
[src]
fn eq(&self, other: &Timer) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Timer) -> bool
[src]
fn ne(&self, other: &Timer) -> bool
This method tests for !=
.
impl Copy for Timer
[src]
impl Copy for Timer
impl Clone for Timer
[src]
impl Clone for Timer