You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
originally, i wanted Clock to be a trait rather than a struct, but that fell apart because i really wanted the global timer to live in a single AtomicPtr, so it couldn't be generic. but, whilst talking to @iximeow about Totally Unrelated Subjects, it occurred to me that if the timer just held onto a &'static dyn Clock, and the global timer was an AtomicPtr<Timer>, you could have a trait based clock. the downside is just that now the clock is double indirected from the timer, which is kinda sad.
The text was updated successfully, but these errors were encountered:
this would also let you make the timer generic over the clock's lifetime, allowing you to have a borrowed clock on the stack. in practice, there are basically no valid civilian uses for this technology, but it might make the unit tests slightly nicer.
originally, i wanted
Clock
to be a trait rather than a struct, but that fell apart because i really wanted the global timer to live in a singleAtomicPtr
, so it couldn't be generic. but, whilst talking to @iximeow about Totally Unrelated Subjects, it occurred to me that if the timer just held onto a&'static dyn Clock
, and the global timer was anAtomicPtr<Timer>
, you could have a trait based clock. the downside is just that now the clock is double indirected from the timer, which is kinda sad.The text was updated successfully, but these errors were encountered: