Skip to main content

once

Macro once 

Source
macro_rules! once {
    ($e:expr) => { ... };
}
Available on crate feature tasks only.
Expand description

Runs the given closure exactly once per call site.

Each invocation expands to its own static Once, so two once! calls in the same function are independent. Useful for one-time thread setup (priority, affinity) on threads that may be re-entered (e.g. tokio blocking pool).