TimeProvider

Trait TimeProvider 

Source
pub trait TimeProvider {
    // Required methods
    fn now() -> Instant;
    fn delay(duration: Duration) -> impl Future<Output = ()>;
}
Expand description

Provides platform-agnostic timing operations

Abstracts timing functionality across different platforms, ensuring consistent animation behavior in both web and native environments.

Required Methods§

Source

fn now() -> Instant

Returns the current instant

Source

fn delay(duration: Duration) -> impl Future<Output = ()>

Creates a future that completes after the specified 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§