product-os-async-executor 0.0.20

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. This trait is intended to be
//! implemented by downstream crates for their specific runtime needs.

use core::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.
/// It is designed to be implemented by downstream users for their chosen async runtime.
///
/// # 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;
}