product-os-async-executor 0.0.18

Product OS : Async Executor provides a set of tools to handle async execution generically so that the desired async library (e.g. tokio, smol) to be used can be chosen at compile time.
Documentation
//! Sleep trait for delaying execution.
//!
//! This module provides a trait for sleeping in async contexts that can be
//! implemented by different async runtimes.

use std::future::Future;


/// Trait for sleeping and delaying execution.
///
/// This trait provides a runtime-agnostic way to sleep for a duration or until a specific time.
///
/// # Type Parameters
///
/// * `D` - The duration type
/// * `T` - The time type
pub trait Sleep<D, T>: Future {
    /// Sleeps for the specified duration.
    fn sleep(period: D) -> Self;
    
    /// Sleeps until the specified time.
    fn sleep_until(time: T) -> Self;
}