ferroid 2.0.0

High-performance ULID and Snowflake-style IDs. Unique, monotonic, and lexicographically sortable IDs optimized for low-latency services and async workloads.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use core::{future::Future, time::Duration};

/// A trait that abstracts over how to sleep for a given [`Duration`] in async
/// contexts.
///
/// This allows the generator to be generic over runtimes like `Tokio` or
/// `Smol`.
pub trait SleepProvider {
    /// We require `Send` so that the future can be safely moved across threads
    fn sleep_for(dur: Duration) -> impl Future<Output = ()> + Send;
}