1
0
forked from ROMEO/nexosim

Implement Clock for references to and boxed Clock

This commit is contained in:
Serge Barral 2025-01-09 17:03:28 +01:00
parent 8de53aff1f
commit 43407741eb

View File

@ -16,6 +16,18 @@ pub trait Clock: Send {
fn synchronize(&mut self, deadline: MonotonicTime) -> SyncStatus;
}
impl<C: Clock + ?Sized> Clock for &mut C {
fn synchronize(&mut self, deadline: MonotonicTime) -> SyncStatus {
(**self).synchronize(deadline)
}
}
impl<C: Clock + ?Sized> Clock for Box<C> {
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 {