You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4368,10 +4386,10 @@ impl<'a, 'b, K, Q: ?Sized, V, S, A: Allocator> VacantEntryRef<'a, 'b, K, Q, V, S
4368
4386
/// assert_eq!(map["poneyland"], 37);
4369
4387
/// ```
4370
4388
#[cfg_attr(feature = "inline-more", inline)]
4371
-
pubfninsert(self,value:V) -> &'amutV
4389
+
pubfninsert(self,value:V) -> &'mapmutV
4372
4390
where
4373
4391
K:Hash,
4374
-
&'bQ:Into<K>,
4392
+
&'keyQ:Into<K>,
4375
4393
S:BuildHasher,
4376
4394
{
4377
4395
let table = &mutself.table.table;
@@ -4383,6 +4401,24 @@ impl<'a, 'b, K, Q: ?Sized, V, S, A: Allocator> VacantEntryRef<'a, 'b, K, Q, V, S
4383
4401
&mut entry.1
4384
4402
}
4385
4403
4404
+
/// provide explicit key at insert-time instead of relying on there being effectively a from &K to K implementation and not working with cloneable values
4405
+
#[cfg_attr(feature = "inline-more", inline)]
4406
+
pubfninsert_kv(self,key:K,value:V) -> &'mapmutV
4407
+
where
4408
+
K:Hash,
4409
+
for<'k>&'kK:Equivalent<&'keyQ>,
4410
+
S:BuildHasher,
4411
+
{
4412
+
let table = &mutself.table.table;
4413
+
assert!((&key).equivalent(&self.key));
4414
+
let entry = table.insert_entry(
4415
+
self.hash,
4416
+
(key, value),
4417
+
make_hasher::<_,V,S>(&self.table.hash_builder),
4418
+
);
4419
+
&mut entry.1
4420
+
}
4421
+
4386
4422
/// Sets the value of the entry with the [`VacantEntryRef`]'s key,
4387
4423
/// and returns an [`OccupiedEntry`].
4388
4424
///
@@ -4400,10 +4436,10 @@ impl<'a, 'b, K, Q: ?Sized, V, S, A: Allocator> VacantEntryRef<'a, 'b, K, Q, V, S
0 commit comments