Trait Clock
Source pub trait Clock:
Send
+ Sync
+ Debug {
// Required method
fn now(&self) -> DateTime<Utc>;
}
Expand description
Provides the current time for session expiry calculations.
Implementors must be Send + Sync so they can be shared across
async tasks via Arc<dyn Clock>.
§Examples
use mcp_execution_server::clock::{Clock, SystemClock};
let clock = SystemClock;
assert!(clock.now().timestamp() > 0);
Returns the current time.
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".