Coverage / crates/spectra-core/src/ids.rs 100.0%
22 of 22 lines run, 11 of 11 functions · run #6 on main · run missed
| 1 | //! Identifiers (spec §9.4): ULIDs, 26 characters of Crockford base32, time | |
| 2 | //! ordered and globally unique, so an id made on one machine merges into a | |
| 3 | //! hub without renaming. | |
| 4 | | |
| 5 | use RngCore; | |
| 6 | ||
| 7 | const CROCKFORD: & = b"0123456789ABCDEFGHJKMNPQRSTVWXYZ"; | |
| 8 | ||
| 9 | /// A new ULID for the current time. | |
| 10 | 11520× | |
| 11 | 11520× | |
| 12 | 11520× | |
| 13 | 11520× | |
| 14 | 11520× | |
| 15 | ||
| 16 | /// A ULID from a millisecond time and 80 bits taken from `random`. | |
| 17 | 11523× | |
| 18 | 11523× | |
| 19 | 299598× | |
| 20 | 11523× | |
| 21 | ||
| 22 | /// Milliseconds since the Unix epoch. | |
| 23 | 25008× | |
| 24 | 25008× | |
| 25 | 25008× | |
| 26 | ||
| 27 | | |
| 28 | | |
| 29 | | |
| 30 | | |
| 31 | | |
| 32 | 1× | |
| 33 | 1× | |
| 34 | 1× | |
| 35 | 1× | |
| 36 | 1× | |
| 37 | 1× | |
| 38 | 1× | |
| 39 | 1× | |
| 40 | |