soaprs-core 0.2.0

Core contracts for soaprs
Documentation
//! Externally supplied time for deterministic application services.

use std::time::SystemTime;

/// Supplies wall-clock time without making core services read the system clock.
///
/// Production runtimes can implement this trait with `SystemTime::now`, while
/// tests use a fixed or manually advanced clock.
pub trait Clock: Send + Sync {
    /// Returns the current wall-clock time.
    fn now(&self) -> SystemTime;
}

impl<F> Clock for F
where
    F: Fn() -> SystemTime + Send + Sync,
{
    fn now(&self) -> SystemTime {
        self()
    }
}