forked from ROMEO/nexosim
Implement Clock for references to and boxed Clock
This commit is contained in:
parent
8de53aff1f
commit
43407741eb
@ -16,6 +16,18 @@ pub trait Clock: Send {
|
|||||||
fn synchronize(&mut self, deadline: MonotonicTime) -> SyncStatus;
|
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.
|
/// The current synchronization status of a clock.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum SyncStatus {
|
pub enum SyncStatus {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user