std/timer
Scheduling primitives for delaying the current task.
timer is separate from Instant and Duration: those files describe
time values, while this file performs time-based waiting.
Import with import std/timer.
timer.sleep
Section titled “timer.sleep”fn sleep(d: Duration): Unit
Suspends the current task for the given duration.
When called inside a concurrent { } block, cancellation of that block’s
context ends the sleep early without producing a user-visible error.
Interactive Tests
assert timer.sleep(Duration.nanoseconds(0)) == Unit