pub struct Delay {
ratio: Ratio,
}
Expand description
The delay of a frame relative to the previous one.
Fields§
§ratio: Ratio
Implementations§
source§impl Delay
impl Delay
sourcepub fn from_numer_denom_ms(numerator: u32, denominator: u32) -> Self
pub fn from_numer_denom_ms(numerator: u32, denominator: u32) -> Self
Create a delay from a ratio of milliseconds.
§Examples
use image::Delay;
let delay_10ms = Delay::from_numer_denom_ms(10, 1);
sourcepub fn from_saturating_duration(duration: Duration) -> Self
pub fn from_saturating_duration(duration: Duration) -> Self
Convert from a duration, clamped between 0 and an implemented defined maximum.
The maximum is at least i32::MAX
milliseconds. It should be noted that the accuracy of
the result may be relative and very large delays have a coarse resolution.
§Examples
use std::time::Duration;
use image::Delay;
let duration = Duration::from_millis(20);
let delay = Delay::from_saturating_duration(duration);
sourcepub fn numer_denom_ms(self) -> (u32, u32)
pub 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 Delay
was previously created with the
from_numer_denom_ms
constructor.
pub(crate) fn from_ratio(ratio: Ratio) -> Self
pub(crate) fn into_ratio(self) -> Ratio
Trait Implementations§
source§impl PartialEq for Delay
impl PartialEq for Delay
source§impl PartialOrd for Delay
impl PartialOrd for Delay
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Delay
impl Eq for Delay
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 UnwindSafe for Delay
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more