/// A safe wrapper around a raw pointer that allows immutable dereferencing. This remains valid as long as the `StablePointerSet` remains
const _: () = assert!(std::mem::size_of::<Option<StablePointer<usize>>>() == std::mem::size_of::<usize>());
/// The caller must ensure that the pointer is valid and points to a valid T that outlives the StablePointer.
/// The caller must ensure the pointer points to a valid T that outlives the returned StablePointer.
/// Elements are stored in stable memory locations using a custom allocator, with the hash set maintaining references.
/// The set can use a custom hasher type for potentially better performance based on workload characteristics.
/// Creates an empty StablePointerSet with the specified capacity, default hasher, and global allocator.
/// Creates an empty StablePointerSet with the specified capacity, hasher, and global allocator.
/// Creates an empty StablePointerSet with the specified capacity, allocator, and default hasher.
/// Searches for a value equal to the provided reference and returns a pointer to the stored element.
// Add the result to the storage, it could be at this point that the entry was inserted by another thread. So
// this insertion might actually fail, in which case we should clean up the created entry and return the old pointer.
// TODO: I suppose this can go wrong with begin_insert(x); insert(x); remove(x); end_insert(x) chain.