Skip to content

Commit

Permalink
Add an Entry API for HashSet
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jun 17, 2022
1 parent decf995 commit af67f7d
Show file tree
Hide file tree
Showing 3 changed files with 445 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/map.rs
Expand Up @@ -5573,7 +5573,7 @@ impl<'a, K, V, S, A: Allocator + Clone> VacantEntry<'a, K, V, S, A> {
}

#[cfg_attr(feature = "inline-more", inline)]
fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, S, A>
pub(crate) fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, S, A>
where
K: Hash,
S: BuildHasher,
Expand Down
6 changes: 3 additions & 3 deletions src/rustc_entry.rs
Expand Up @@ -56,10 +56,10 @@ where

/// A view into a single entry in a map, which may either be vacant or occupied.
///
/// This `enum` is constructed from the [`entry`] method on [`HashMap`].
/// This `enum` is constructed from the [`rustc_entry`] method on [`HashMap`].
///
/// [`HashMap`]: struct.HashMap.html
/// [`entry`]: struct.HashMap.html#method.rustc_entry
/// [`rustc_entry`]: struct.HashMap.html#method.rustc_entry
pub enum RustcEntry<'a, K, V, A = Global>
where
A: Allocator + Clone,
Expand Down Expand Up @@ -145,7 +145,7 @@ impl<'a, K, V, A: Allocator + Clone> RustcEntry<'a, K, V, A> {
/// use hashbrown::HashMap;
///
/// let mut map: HashMap<&str, u32> = HashMap::new();
/// let entry = map.entry("horseyland").insert(37);
/// let entry = map.rustc_entry("horseyland").insert(37);
///
/// assert_eq!(entry.key(), &"horseyland");
/// ```
Expand Down

0 comments on commit af67f7d

Please sign in to comment.