pub struct LongPressDetector { /* private fields */ }Expand description
Detects long-press gestures using absolute timestamps.
Call update() on each poll cycle with the current edge (if any) and the
current monotonic time in milliseconds.
Implementations§
Source§impl LongPressDetector
impl LongPressDetector
pub fn new() -> Self
Sourcepub fn with_threshold(threshold_ms: u32) -> Self
pub fn with_threshold(threshold_ms: u32) -> Self
Create a detector with a custom threshold.
Sourcepub fn new_fired() -> Self
pub fn new_fired() -> Self
Create a detector in “fired” state — a subsequent Deactivate will be suppressed. Used after preset switch to ignore stale button releases.
Sourcepub fn update(&mut self, edge: Option<Edge>, now_ms: u32) -> Option<Gesture>
pub fn update(&mut self, edge: Option<Edge>, now_ms: u32) -> Option<Gesture>
Update with the current edge and timestamp. Returns a gesture when detected.
Trait Implementations§
Source§impl Clone for LongPressDetector
impl Clone for LongPressDetector
Source§fn clone(&self) -> LongPressDetector
fn clone(&self) -> LongPressDetector
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 moreSource§impl Debug for LongPressDetector
impl Debug for LongPressDetector
Auto Trait Implementations§
impl Freeze for LongPressDetector
impl RefUnwindSafe for LongPressDetector
impl Send for LongPressDetector
impl Sync for LongPressDetector
impl Unpin for LongPressDetector
impl UnsafeUnpin for LongPressDetector
impl UnwindSafe for LongPressDetector
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