Coverage / crates/spectra-core/src/ids.rs 100.0%
38 of 38 lines run, 13 of 13 functions · run #18 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 | 12334× | |
| 11 | 12334× | |
| 12 | 12334× | |
| 13 | 12334× | |
| 14 | 12334× | |
| 15 | ||
| 16 | /// A ULID from a millisecond time and 80 bits taken from `random`. | |
| 17 | 12337× | |
| 18 | 12337× | |
| 19 | 320762× | |
| 20 | 12337× | |
| 21 | ||
| 22 | /// Milliseconds since the Unix epoch. | |
| 23 | 27490× | |
| 24 | 27490× | |
| 25 | 27490× | |
| 26 | ||
| 27 | /// A time as people and models read it: `2026-11-02 21:43Z`, UTC. | |
| 28 | 56× | |
| 29 | 56× | |
| 30 | 56× | |
| 31 | 56× | |
| 32 | | |
| 33 | 56× | |
| 34 | 56× | |
| 35 | 56× | |
| 36 | 56× | |
| 37 | 56× | |
| 38 | 56× | |
| 39 | 56× | |
| 40 | 56× | |
| 41 | 56× | |
| 42 | 56× | |
| 43 | 56× | |
| 44 | ||
| 45 | | |
| 46 | | |
| 47 | | |
| 48 | | |
| 49 | | |
| 50 | 1× | |
| 51 | 1× | |
| 52 | 1× | |
| 53 | 1× | |
| 54 | 1× | |
| 55 | 1× | |
| 56 | 1× | |
| 57 | 1× | |
| 58 | 1× | |
| 59 | |