From 43407741ebb72fb62a0b992c22697658210a5afd Mon Sep 17 00:00:00 2001 From: Serge Barral Date: Thu, 9 Jan 2025 17:03:28 +0100 Subject: [PATCH] Implement Clock for references to and boxed Clock --- nexosim/src/time/clock.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nexosim/src/time/clock.rs b/nexosim/src/time/clock.rs index dc9dc17..789558d 100644 --- a/nexosim/src/time/clock.rs +++ b/nexosim/src/time/clock.rs @@ -16,6 +16,18 @@ pub trait Clock: Send { fn synchronize(&mut self, deadline: MonotonicTime) -> SyncStatus; } +impl Clock for &mut C { + fn synchronize(&mut self, deadline: MonotonicTime) -> SyncStatus { + (**self).synchronize(deadline) + } +} + +impl Clock for Box { + fn synchronize(&mut self, deadline: MonotonicTime) -> SyncStatus { + (**self).synchronize(deadline) + } +} + /// The current synchronization status of a clock. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum SyncStatus {