pub enum WriterClock {
Live,
Test(Arc<AtomicU64>),
}Expand description
Minimal Send time source for streaming writers.
Live reads the wall clock directly; Test reads a shared atomic that the
owner of the source clock (e.g. a PyO3 wrapper holding a VirtualClock)
refreshes before forwarding writer calls.
Variants§
Live
Wall-clock time via [nanos_since_unix_epoch].
Test(Arc<AtomicU64>)
Externally driven time stored in a shared atomic (nanoseconds since the UNIX epoch).
Implementations§
Source§impl WriterClock
impl WriterClock
Sourcepub fn timestamp_ns(&self) -> UnixNanos
pub fn timestamp_ns(&self) -> UnixNanos
Returns the current timestamp in nanoseconds since the UNIX epoch.
Builds a writer clock from a shared dyn Clock.
Returns WriterClock::Live for a [LiveClock]. For any other clock
(e.g. VirtualClock) it returns a WriterClock::Test source seeded with
the clock’s current time, plus the shared atomic the caller must refresh
from the source clock before each forwarded writer call.
Trait Implementations§
Source§impl Clone for WriterClock
impl Clone for WriterClock
Auto Trait Implementations§
impl Freeze for WriterClock
impl RefUnwindSafe for WriterClock
impl Send for WriterClock
impl Sync for WriterClock
impl Unpin for WriterClock
impl UnsafeUnpin for WriterClock
impl UnwindSafe for WriterClock
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more