Clarify behavior of ShardedHashMap::insert_unique

This commit is contained in:
Daria Sukhonina
2026-04-22 12:39:19 +03:00
parent 93d0186957
commit fa4d2ad671
@@ -185,7 +185,9 @@ pub fn get_or_insert_with(&self, key: K, default: impl FnOnce() -> V) -> V
/// Insert value into the [`ShardedHashMap`] with unique key.
///
/// Checks uniqueness if debug_assertions enabled.
/// This function panics if debug_assertions are enabled and uniqueness is violated.
/// If uniqueness is violated but debug_assertions are disabled then lookups will arbitrarily
/// return one of the inserted elements.
#[inline]
pub fn insert_unique(&self, key: K, value: V) {
let hash = make_hash(&key);