pub struct Fps { /* private fields */ }Expand description
Simple type for tracking frames-per-second.
Implementations§
Source§impl Fps
impl Fps
Sourcepub const DEFAULT_WINDOW_LEN: usize = 60usize
pub const DEFAULT_WINDOW_LEN: usize = 60usize
The window length used by the default constructor.
Sourcepub fn with_window_len(window_len: usize) -> Self
pub fn with_window_len(window_len: usize) -> Self
Create a new Fps with the given window length as a number of frames.
The larger the window, the “smoother” the FPS.
Sourcepub fn tick(&self)
pub fn tick(&self)
Call this once per frame to allow the Fps instance to sample the rate internally.
Sourcepub fn avg(&self) -> f64
pub fn avg(&self) -> f64
Retrieve the average frames-per-second at the moment of the last call to tick.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Fps
impl !RefUnwindSafe for Fps
impl Send for Fps
impl !Sync for Fps
impl Unpin for Fps
impl UnwindSafe for Fps
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