Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,7 @@ impl<K, V, S, A: Allocator + Clone> HashMap<K, V, S, A> {
///
/// # Note
///
/// Calling the function safe, but using raw hash table API's may require
/// Calling this function is safe, but using the raw hash table API may require
/// unsafe functions or blocks.
///
/// `RawTable` API gives the lowest level of control under the map that can be useful
Expand Down
22 changes: 22 additions & 0 deletions src/set.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(feature = "raw")]
use crate::raw::RawTable;
use crate::{Equivalent, TryReserveError};
use alloc::borrow::ToOwned;
use core::fmt;
Expand Down Expand Up @@ -1135,6 +1137,26 @@ where
None => None,
}
}

/// Returns a mutable reference to the [`RawTable`] used underneath [`HashSet`].
/// This function is only available if the `raw` feature of the crate is enabled.
///
/// # Note
///
/// Calling this function is safe, but using the raw hash table API may require
/// unsafe functions or blocks.
///
/// `RawTable` API gives the lowest level of control under the set that can be useful
/// for extending the HashSet's API, but may lead to *[undefined behavior]*.
///
/// [`HashSet`]: struct.HashSet.html
/// [`RawTable`]: raw/struct.RawTable.html
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
#[cfg(feature = "raw")]
#[cfg_attr(feature = "inline-more", inline)]
pub fn raw_table(&mut self) -> &mut RawTable<(T, ()), A> {
self.map.raw_table()
}
}

impl<T, S, A> PartialEq for HashSet<T, S, A>
Expand Down