Struct FPS

Source
pub struct FPS<const MAX_FPS: usize, C: Clock> { /* private fields */ }
Expand description

Measures Frames Per Second (FPS).

MAX_FPS - Defines the maximum FPS that you expect to measure.

Implementations§

Source§

impl<const MAX_FPS: usize, C: Clock> FPS<MAX_FPS, C>

Source

pub fn new(clock: C) -> FPS<MAX_FPS, C>

Creates a new Frames Per Second counter.

Source

pub fn tick(&mut self) -> usize

Adds another frame tick and returns the current Frames Pre Second.

§Panics

When Clock::try_now() returns an error or if the MAX_FPS is reached.

Source

pub fn tick_max(&mut self) -> usize

Adds another frame tick and returns the current Frames Pre Second.

This method will not panic if the MAX_FPS is reached, instead it will just return the MAX_FPS value (capping it in a nutshell).

§Panics

If Clock::try_now() returns an error.

Source

pub fn try_tick_max(&mut self) -> Result<usize, Error>

Adds another frame tick and returns the current Frames Pre Second.

This method will not return an error if the MAX_FPS is reached, instead it will just return the MAX_FPS value (capping it in a nutshell).

Source

pub fn try_tick(&mut self) -> Result<usize, Error>

Adds another frame tick and returns the current Frames Pre Second.

§Panics

When Clock::try_now() returns an error or if the MAX_FPS is reached.

Trait Implementations§

Source§

impl<const MAX_FPS: usize, C: Clone + Clock> Clone for FPS<MAX_FPS, C>

Source§

fn clone(&self) -> FPS<MAX_FPS, C>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const MAX_FPS: usize, C: Debug + Clock> Debug for FPS<MAX_FPS, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const MAX_FPS: usize, C> Default for FPS<MAX_FPS, C>
where C: Clock + Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const MAX_FPS: usize, C> Freeze for FPS<MAX_FPS, C>
where C: Freeze, <C as Clock>::T: Freeze,

§

impl<const MAX_FPS: usize, C> RefUnwindSafe for FPS<MAX_FPS, C>
where C: RefUnwindSafe, <C as Clock>::T: RefUnwindSafe,

§

impl<const MAX_FPS: usize, C> Send for FPS<MAX_FPS, C>
where C: Send, <C as Clock>::T: Send,

§

impl<const MAX_FPS: usize, C> Sync for FPS<MAX_FPS, C>
where C: Sync, <C as Clock>::T: Sync,

§

impl<const MAX_FPS: usize, C> Unpin for FPS<MAX_FPS, C>
where C: Unpin, <C as Clock>::T: Unpin,

§

impl<const MAX_FPS: usize, C> UnwindSafe for FPS<MAX_FPS, C>
where C: UnwindSafe, <C as Clock>::T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.