This commit is contained in:
Joel Wejdenstål 2023-07-11 05:30:00 +02:00
parent 3b418466ed
commit 6616a8d28c
No known key found for this signature in database
GPG Key ID: DF03CEFBB1A915AA
1 changed files with 12 additions and 8 deletions

View File

@ -100,7 +100,10 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> Entry<'a, K, V, S> {
/// consider [`insert`] as it doesn't need to clone the key.
///
/// [`insert`]: Entry::insert
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, S> where K: Clone {
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, S>
where
K: Clone,
{
match self {
Entry::Occupied(mut entry) => {
entry.insert(value);
@ -145,7 +148,10 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> VacantEntry<'a, K, V, S> {
}
/// Sets the value of the entry with the VacantEntrys key, and returns an OccupiedEntry.
pub fn insert_entry(mut self, value: V) -> OccupiedEntry<'a, K, V, S> where K: Clone {
pub fn insert_entry(mut self, value: V) -> OccupiedEntry<'a, K, V, S>
where
K: Clone,
{
unsafe {
self.shard.insert(self.key.clone(), SharedValue::new(value));
@ -230,8 +236,6 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> OccupiedEntry<'a, K, V, S> {
}
}
#[cfg(test)]
mod tests {
use crate::DashMap;