pub struct ScrollInputQueue { /* private fields */ }Expand description
Thread-safe queue for scroll inputs, shared between event handlers and timer callbacks.
Event handlers push inputs, the physics timer pops them. Protected by a Mutex
so that the timer callback (which only has &CallbackInfo / *const LayoutWindow)
can still consume pending inputs without needing &mut.
Implementations§
Source§impl ScrollInputQueue
impl ScrollInputQueue
pub fn new() -> Self
Sourcepub fn push(&self, input: ScrollInput)
pub fn push(&self, input: ScrollInput)
Push a new scroll input (called from platform event handler)
Sourcepub fn take_all(&self) -> Vec<ScrollInput>
pub fn take_all(&self) -> Vec<ScrollInput>
Take all pending inputs (called from timer callback)
Sourcepub fn take_recent(&self, max_events: usize) -> Vec<ScrollInput>
pub fn take_recent(&self, max_events: usize) -> Vec<ScrollInput>
Take at most max_events recent inputs, sorted by timestamp (newest last).
Any older events beyond max_events are discarded.
This prevents the physics timer from processing an unbounded backlog.
Sourcepub fn has_pending(&self) -> bool
pub fn has_pending(&self) -> bool
Check if there are pending inputs without consuming them
Trait Implementations§
Source§impl Clone for ScrollInputQueue
impl Clone for ScrollInputQueue
Source§fn clone(&self) -> ScrollInputQueue
fn clone(&self) -> ScrollInputQueue
Returns a duplicate of the value. Read more
1.0.0 · 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 ScrollInputQueue
impl Debug for ScrollInputQueue
Source§impl Default for ScrollInputQueue
impl Default for ScrollInputQueue
Source§fn default() -> ScrollInputQueue
fn default() -> ScrollInputQueue
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ScrollInputQueue
impl RefUnwindSafe for ScrollInputQueue
impl Send for ScrollInputQueue
impl Sync for ScrollInputQueue
impl Unpin for ScrollInputQueue
impl UnsafeUnpin for ScrollInputQueue
impl UnwindSafe for ScrollInputQueue
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> 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