Struct Delay

struct Delay { ... }

The delay of a frame relative to the previous one.

Implementations

impl Delay

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);
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);
fn numer_denom_ms(self: 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.

impl Clone for Delay

fn clone(self: &Self) -> Delay

impl Copy for Delay

impl Debug for Delay

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

impl Eq for Delay

impl Freeze for Delay

impl PartialEq for Delay

fn eq(self: &Self, other: &Delay) -> bool

impl PartialOrd for Delay

fn partial_cmp(self: &Self, other: &Delay) -> Option<Ordering>

impl RefUnwindSafe for Delay

impl Send for Delay

impl StructuralPartialEq for Delay

impl Sync for Delay

impl Unpin for Delay

impl UnsafeUnpin for Delay

impl UnwindSafe for Delay

impl<T> Any for Delay

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Delay

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Delay

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

impl<T> CloneToUninit for Delay

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

impl<T> From for Delay

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for Delay

unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> ToOwned for Delay

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Delay

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Delay

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

impl<T, U> TryInto for Delay

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