Trait Time
pub trait Time:
Send
+ Sync
+ Unpin {
// Required methods
fn delay_for<'async_trait>(
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>;
fn timeout<'async_trait, F>(
duration: Duration,
future: F,
) -> Pin<Box<dyn Future<Output = Result<<F as Future>::Output, Error>> + Send + 'async_trait>>
where F: 'async_trait + 'static + Future + Send;
// Provided method
fn current_time() -> u64 { ... }
}Expand description
Generic Time for Delay and Timeout.
Required Methods§
Provided Methods§
fn current_time() -> u64
fn current_time() -> u64
Get the current time as a Unix timestamp.
This returns the number of seconds since the Unix epoch.
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.