A temporary directory that is actually unique, and cleans up after itself.
Nine files in this workspace had invented their own, and five different ways of trying to make the name unique:
kevy-persist/feed_meta.rs process::id() + Instant::now()
kevy-persist/shards_meta.rs process::id() + process::id()
kevy-persist/reshard.rs SystemTime
kevy-cli/backup.rs nanos
kevy-uring/ring_tests.rs process::id()
…
None of them is unique. process::id() is the SAME for every test in a
binary — cargo runs them as threads, not processes — so two tests in the same
file get the same directory and stamp on each other's files. A clock is
unique only until two threads read it inside the same tick, which under
parallel test execution is exactly what happens. That is a flake: green on a
quiet machine, red under load, and it looks like the code is broken rather
than the fixture.
A process id and a monotonic counter, together, cannot collide: the counter separates threads within a process and the pid separates processes. That is the whole trick, and it is why this is one crate instead of nine copies.