Trait Resolution

Source
pub trait Resolution {
    const MAX_DURATION: Duration;

    // Required methods
    fn cycle_steps(duration: &Duration, upper_bound: bool) -> u32;
    fn whole_steps(duration: &Duration) -> u64;
    fn steps_as_duration(steps: u64) -> Duration;
}
Expand description

A timer resolution.

Finer resolutions allow for more precise timers, coarser resolutions may perform better due to grouping targets that are close together.

Required Associated Constants§

Source

const MAX_DURATION: Duration

The maximum duration that can be represented as u32 at this resolution.

Required Methods§

Source

fn cycle_steps(duration: &Duration, upper_bound: bool) -> u32

Convert the given duration into timer cycle steps. The given duration is guaranteed to be smaller than Resolution::MAX_DURATION.

If upper_bound is true, the returned value should be rounded up.

Source

fn whole_steps(duration: &Duration) -> u64

Return total steps required for the given duration. The returned steps should not be rounded up.

Source

fn steps_as_duration(steps: u64) -> Duration

Convert the given steps to a duration.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§