pub struct MonotonicTimestampGenerator { /* private fields */ }
Expand description
Monotonic timestamp generator. Guarantees monotonicity of timestamps. If system clock will not provide an increased timestamp, then the timestamp will be artificially increased. If the config is provided and the clock skew is bigger than warning_threshold (by default 1 second), then the user will be warned about the skew repeatedly, with warning_interval provided in the settings (by default 1 second). Remember that this generator only guarantees monotonicity within one instance of this struct! If you create multiple instances the monotonicity guarantee becomes void.
Implementations§
Source§impl MonotonicTimestampGenerator
impl MonotonicTimestampGenerator
pub fn with_warning_times( self, warning_threshold: Duration, warning_interval: Duration, ) -> Self
pub fn without_warnings(self) -> Self
Trait Implementations§
Source§impl TimestampGenerator for MonotonicTimestampGenerator
impl TimestampGenerator for MonotonicTimestampGenerator
Source§fn next_timestamp(&self) -> i64
fn next_timestamp(&self) -> i64
This generates a new timestamp
Auto Trait Implementations§
impl !Freeze for MonotonicTimestampGenerator
impl RefUnwindSafe for MonotonicTimestampGenerator
impl Send for MonotonicTimestampGenerator
impl Sync for MonotonicTimestampGenerator
impl Unpin for MonotonicTimestampGenerator
impl UnwindSafe for MonotonicTimestampGenerator
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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