Skip to content

Commit

Permalink
Merge pull request #738 from gvozdvmozgu/update-indexmap
Browse files Browse the repository at this point in the history
implement `Update` trait for `IndexMap`, and `IndexSet`
  • Loading branch information
Veykril authored Feb 27, 2025
2 parents 99be5d9 + f773432 commit 9107eeb
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,37 @@ where
}
}

unsafe impl<K, S> Update for hashbrown::HashSet<K, S>
where
K: Update + Eq + Hash,
S: BuildHasher,
{
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool {
maybe_update_set!(old_pointer, new_set)
}
}

unsafe impl<K, V, S> Update for indexmap::IndexMap<K, V, S>
where
K: Update + Eq + Hash,
V: Update,
S: BuildHasher,
{
unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool {
maybe_update_map!(old_pointer, new_map)
}
}

unsafe impl<K, S> Update for indexmap::IndexSet<K, S>
where
K: Update + Eq + Hash,
S: BuildHasher,
{
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool {
maybe_update_set!(old_pointer, new_set)
}
}

unsafe impl<K, V> Update for BTreeMap<K, V>
where
K: Update + Eq + Ord,
Expand Down

0 comments on commit 9107eeb

Please sign in to comment.