pub struct Ticker { /* private fields */ }
Expand description
TID Generator
This version uses 53-bit microsecond counter (since UNIX epoch), and a random 10-bit clock id.
If the current timestamp is not greater than the last timestamp (either because clock did not
advance monotonically, or multiple TIDs were generated in the same microsecond (very unlikely),
the timestamp is simply incremented.
394
395
396
fn default() -> Self {
Self::new()
}
366
367
368
369
370
371
372
373
374
375
pub fn new() -> Self {
let mut ticker = Self {
last_timestamp: 0,
clock_id: rand::random::<u16>() & 0x03FF,
};
ticker.next_tid();
ticker
}
Returns the “default value” for a type.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Instruments this type with the provided
Span, returning an
Instrumented wrapper.
Read more
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.