Struct Delay
pub struct Delay { /* private fields */ }
The delay of a frame relative to the previous one.
The ratio is reduced on construction which means equality comparisons is reliable even when
mixing different bases. Note however that there is an upper limit to the delays that can be
represented exactly when using Self::from_saturating_duration which depends on the
granularity of the interval.
use Delay;
let delay_10ms = from_numer_denom_ms;
let delay_10000us = from_numer_denom_ms;
assert_eq!;
Implementations
impl Delay
fn from_numer_denom_ms(numerator: u32, denominator: u32) -> SelfCreate a delay from a ratio of milliseconds.
Examples
use Delay; let delay_10ms = from_numer_denom_ms;fn from_saturating_duration(duration: Duration) -> SelfConvert from a duration, clamped between 0 and an implemented defined maximum.
The maximum is at least
i32::MAXmilliseconds. It should be noted that the accuracy of the result may be relative and very large delays have a coarse resolution.Examples
use Duration; use Delay; let duration = from_millis; let delay = from_saturating_duration;fn numer_denom_ms(self) -> (u32, u32)The numerator and denominator of the delay in milliseconds.
This is guaranteed to be an exact conversion if the
Delaywas previously created with thefrom_numer_denom_msconstructor.
Trait Implementations
impl Clone for Delay
fn clone(&self) -> Self
impl Copy for Delay
impl Debug for Delay
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Delay
impl PartialEq for Delay
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Delay
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
impl StructuralPartialEq for Delay
Auto Trait Implementations
impl Freeze for Delay
impl RefUnwindSafe for Delay
impl Send for Delay
impl Sync for Delay
impl Unpin for Delay
impl UnsafeUnpin for Delay
impl UnwindSafe for Delay
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for Delay
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for Delay
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for Delay
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Delay
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Delay
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Delay
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Delay
fn from(t: T) -> TReturns the argument unchanged.
impl<T> IntoEither for Delay
impl<T> Pointable for Delay
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for Delay
where
T: ?Sized,
impl<T> ToOwned for Delay
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Delay
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Delay
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Delay
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>