MonotonicUuid structv0.1.0
pub struct MonotonicUuid {
// private fields
}
The format guarantees ordering only between milliseconds; two UUIDs made in the same one have random tails and may sort either way. This closes that by remembering the last value it produced: when the clock has not advanced, it increments the previous UUID instead of drawing a fresh one, so every value it returns is strictly greater than the last. A caller owns one of these rather than sharing a global, so two components generating identifiers do not serialize against each other or interleave into one sequence.
Constructors
MonotonicUuid
pub func MonotonicUuid() -> MonotonicUuid
A generator that has produced nothing yet.
Returns: the generator, which has produced nothing yet
Methods
Next
pub func Next(self: &var MonotonicUuid) -> Uuid ! EntropyError
The next identifier, strictly greater than the one before it.
Returns: the next value, which sorts after every value this generator has produced, or why entropy was unavailable