pub struct KeyRepeatState {
pub key_index: usize,
pub pressed_at: Instant,
pub last_fired_at: Option<Instant>,
}Expand description
Hold-to-repeat state captured the moment the user presses a
repeat-eligible key (currently Backspace only). Polled from
super::paint_software_keyboard every frame so the firing cadence
happens in lockstep with the animation loop — no separate timer
thread, fully WASM-friendly.
Fields§
§key_index: usizeIndex into last_painted_keys. We re-check the key still exists
and is still under the pointer each tick.
pressed_at: InstantWhen the user pressed the key down. held_for = now - pressed_at.
last_fired_at: Option<Instant>When we last fired a synthetic key for this hold. None = never
fired; the first fire happens after initial_delay elapses.
Implementations§
Source§impl KeyRepeatState
impl KeyRepeatState
Sourcepub const INITIAL_DELAY: Duration
pub const INITIAL_DELAY: Duration
How long the user must hold before the first repeat fires.
Sourcepub const REPEAT_PERIOD: Duration
pub const REPEAT_PERIOD: Duration
Period between subsequent repeats. Constant for now; we could ramp it down for an accelerating delete-line feel later.
Trait Implementations§
Source§impl Clone for KeyRepeatState
impl Clone for KeyRepeatState
Source§fn clone(&self) -> KeyRepeatState
fn clone(&self) -> KeyRepeatState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for KeyRepeatState
Auto Trait Implementations§
impl Freeze for KeyRepeatState
impl RefUnwindSafe for KeyRepeatState
impl Send for KeyRepeatState
impl Sync for KeyRepeatState
impl Unpin for KeyRepeatState
impl UnsafeUnpin for KeyRepeatState
impl UnwindSafe for KeyRepeatState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more