[−][src]Struct stakker::MaxTimerKey
Timer key for a Max timer
Used by the timer_max!
macro and the timer_max_*
methods in
Core
. It can be used to delete a timer or change its expiry
time. It is plain Copy
data, 8 bytes long. Note that the key
should only be used on this same Stakker instance. If it is
used on another then it might cause a panic.
A "max" timer sets a timer at the first-provided timeout time, then just records the largest of the timeout values provided until that original timer expires, at which point it sets a new timer. So this naturally absorbs a lot of changes without having to delete any timers. A typical use might be to take some action in a gap in activity, for example to do an expensive background check in a gap in the user's typing into a UI field. To implement this, the timer expiry time might be set to 'now' + 300ms by each keypress, for example:
fn handle_keypress(&mut self, cx: CX![], ...) { ::: timer_max!(&mut self.timer, cx.now() + Duration::from_millis(300), [cx], check_focus_field()); }
Trait Implementations
impl Clone for MaxTimerKey
[src]
fn clone(&self) -> MaxTimerKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for MaxTimerKey
[src]
impl Debug for MaxTimerKey
[src]
impl Default for MaxTimerKey
[src]
fn default() -> MaxTimerKey
[src]
impl Eq for MaxTimerKey
[src]
impl PartialEq<MaxTimerKey> for MaxTimerKey
[src]
fn eq(&self, other: &MaxTimerKey) -> bool
[src]
fn ne(&self, other: &MaxTimerKey) -> bool
[src]
impl StructuralEq for MaxTimerKey
[src]
impl StructuralPartialEq for MaxTimerKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for MaxTimerKey
impl Send for MaxTimerKey
impl Sync for MaxTimerKey
impl Unpin for MaxTimerKey
impl UnwindSafe for MaxTimerKey
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
[src]
T: Clone + Any,
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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,