From 6bc0a82e2157ad28728b277d6d73d3acdfefa7bd Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 18 Sep 2026 10:29:36 +0200 Subject: [PATCH] Add `IdSaltSet` and `IdSaltMap` (#8590) --- crates/egui/src/id_salt.rs | 10 ++++++++++ crates/egui/src/lib.rs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/id_salt.rs b/crates/egui/src/id_salt.rs index 85212d3f..11bcf6c6 100644 --- a/crates/egui/src/id_salt.rs +++ b/crates/egui/src/id_salt.rs @@ -93,6 +93,16 @@ impl core::fmt::Debug for IdSalt { } } +// ---------------------------------------------------------------------------- + +/// `IdSaltSet` is a `HashSet` optimized by knowing that [`IdSalt`] has good entropy, and doesn't need more hashing. +pub type IdSaltSet = nohash_hasher::IntSet; + +/// `IdSaltMap` is a `HashMap` optimized by knowing that [`IdSalt`] has good entropy, and doesn't need more hashing. +pub type IdSaltMap = nohash_hasher::IntMap; + +// ---------------------------------------------------------------------------- + /// In debug builds, remember the `Debug`-formatted source that produced each [`IdSalt`]. /// /// Used by [`IdSalt`]'s `Debug` impl so that `IdSalt::new("foo")` prints as diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 5a88b7ed..30c215da 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -484,7 +484,7 @@ pub use self::{ epaint::text::TextWrapMode, grid::Grid, id::{Id, IdMap, IdSet}, - id_salt::{AsIdSalt, IdSalt}, + id_salt::{AsIdSalt, IdSalt, IdSaltMap, IdSaltSet}, input_state::{InputOptions, InputState, MultiTouchInfo, PointerState, SurrenderFocusOn}, layers::{LayerId, Order}, layout::*,