[−][src]Struct egui::MovementTracker
This struct tracks recent values of some time series. This can be used for things like smoothed averages (for e.g. FPS) or for smoothed velocity (e.g. mouse pointer speed). All times are in seconds.
Implementations
impl<T> MovementTracker<T> where
T: Copy,
[src]
T: Copy,
pub fn new(max_len: usize, max_age: f64) -> Self
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn len(&self) -> usize
[src]
pub fn dt(&self) -> f32
[src]
Amount of time contained from start to end in this MovementTracker
pub fn values<'a>(&'a self) -> impl Iterator<Item = T> + 'a
[src]
pub fn clear(&mut self)
[src]
pub fn add(&mut self, now: f64, value: T)
[src]
Values must be added with a monotonically increasing time, or at least not decreasing.
pub fn mean_time_interval(&self) -> Option<f32>
[src]
Mean time difference between values in this MovementTracker
.
pub fn flush(&mut self, now: f64)
[src]
Remove samples that are too old
impl<T> MovementTracker<T> where
T: Copy,
T: Sum,
T: Div<f32, Output = T>,
[src]
T: Copy,
T: Sum,
T: Div<f32, Output = T>,
impl<T, Vel> MovementTracker<T> where
T: Copy,
T: Sub<Output = Vel>,
Vel: Div<f32, Output = Vel>,
[src]
T: Copy,
T: Sub<Output = Vel>,
Vel: Div<f32, Output = Vel>,
pub fn velocity(&self) -> Option<Vel>
[src]
Calculate a smooth velocity (per second) over the entire time span
Trait Implementations
impl<T: Clone> Clone for MovementTracker<T>
[src]
fn clone(&self) -> MovementTracker<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for MovementTracker<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for MovementTracker<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for MovementTracker<T> where
T: Send,
T: Send,
impl<T> Sync for MovementTracker<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MovementTracker<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for MovementTracker<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
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.
fn to_owned(&self) -> T
[src]
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.
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>,