pub struct VelocityTracker { /* private fields */ }Expand description
Recent (time_ms, position) samples for a drag’s release velocity: a
delta-over-window estimate, not Flutter’s least-squares fit.
Implementations§
Source§impl VelocityTracker
impl VelocityTracker
pub fn new() -> Self
Sourcepub fn record(&mut self, time_ms: f64, position: f64)
pub fn record(&mut self, time_ms: f64, position: f64)
Record a sample, pruning those older than the window.
Sourcepub fn velocity(&self) -> f64
pub fn velocity(&self) -> f64
Velocity in px/s across the window; 0.0 with under two samples or no span.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for VelocityTracker
impl Clone for VelocityTracker
Source§impl Debug for VelocityTracker
impl Debug for VelocityTracker
Auto Trait Implementations§
impl Freeze for VelocityTracker
impl RefUnwindSafe for VelocityTracker
impl Send for VelocityTracker
impl Sync for VelocityTracker
impl Unpin for VelocityTracker
impl UnsafeUnpin for VelocityTracker
impl UnwindSafe for VelocityTracker
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> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.