Open-Source Wikis

/

uv

/

Crates

/

uv-once-map

astral-sh/uv

uv-once-map

crates/uv-once-map/ is an async-safe, single-flight map: each key has its work done at most once, and concurrent waiters all observe the same result.

Purpose

Many resolver and distribution operations are expensive (HTTP fetches, sdist builds) and keyed by the same identifier. OnceMap is the synchronization primitive that lets uv issue a single fetch/build per key while letting parallel callers all observe the result.

Key abstractions

  • OnceMap<K, V> — the map.
  • OnceMap::wait(key, fn) — atomically run fn only the first time, then hand the cached result to subsequent callers.

See also

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

uv-once-map – uv wiki | Factory