pub struct UseTimer {
pub ticks: Signal<u64>,
pub interval_ms: u32,
}Expand description
Reactive state for a repeating timer.
The handle carries the number of ticks that have fired and the period they fire at.
The tick count is a Signal<u64>: a render closure that reads it
re-renders on every tick, and nothing else in the tree is disturbed.
The interval is owned by the framework and is cleared when the component unmounts, so a timer cannot outlive its owner.
Fields§
§ticks: Signal<u64>How many times the timer has fired.
interval_ms: u32The period in milliseconds.
Implementations§
Source§impl UseTimer
impl UseTimer
pub fn get_ticks(&self) -> Signal<u64>
pub fn get_mut_ticks(&mut self) -> &mut Signal<u64>
pub fn set_ticks(&mut self, val: Signal<u64>) -> &mut Self
pub fn get_interval_ms(&self) -> u32
pub fn get_mut_interval_ms(&mut self) -> &mut u32
pub fn set_interval_ms(&mut self, val: u32) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UseTimer
impl RefUnwindSafe for UseTimer
impl Send for UseTimer
impl Sync for UseTimer
impl Unpin for UseTimer
impl UnsafeUnpin for UseTimer
impl UnwindSafe for UseTimer
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