@@ -214,9 +214,8 @@ pub use crate::write::WriteHandle;
214
214
mod read;
215
215
pub use crate :: read:: { MapReadRef , ReadGuardIter , ReadHandle , ReadHandleFactory } ;
216
216
217
- pub mod shallow_copy;
218
- pub use crate :: shallow_copy:: ShallowCopy ;
219
- use shallow_copy:: MaybeShallowCopied ;
217
+ mod shallow_copy;
218
+ use shallow_copy:: ForwardThroughAliased ;
220
219
221
220
// Expose `ReadGuard` since it has useful methods the user will likely care about.
222
221
#[ doc( inline) ]
@@ -256,14 +255,11 @@ impl<V: ?Sized> fmt::Debug for Predicate<V> {
256
255
257
256
/// A pending map operation.
258
257
#[ non_exhaustive]
259
- pub ( crate ) enum Operation < K , V , M >
260
- where
261
- V : ShallowCopy ,
262
- {
258
+ pub ( crate ) enum Operation < K , V , M > {
263
259
/// Replace the set of entries for this key with this value.
264
- Replace ( K , MaybeShallowCopied < V > ) ,
260
+ Replace ( K , ForwardThroughAliased < V > ) ,
265
261
/// Add this value to the set of entries for this key.
266
- Add ( K , MaybeShallowCopied < V > ) ,
262
+ Add ( K , ForwardThroughAliased < V > ) ,
267
263
/// Remove this value from the set of entries for this key.
268
264
RemoveValue ( K , V ) ,
269
265
/// Remove the value set for this key.
@@ -280,29 +276,30 @@ where
280
276
/// Note that this will iterate once over all the keys internally.
281
277
Purge ,
282
278
/// Retains all values matching the given predicate.
283
- Retain ( K , Predicate < V :: Target > ) ,
284
- /// Shrinks [`MaybeShallowCopied<V>alues `] to their minimum necessary size, freeing memory
279
+ Retain ( K , Predicate < V > ) ,
280
+ /// Shrinks [`Values `] to their minimum necessary size, freeing memory
285
281
/// and potentially improving cache locality.
286
282
///
287
- /// If no key is given, all `MaybeShallowCopied<V>alues ` will shrink to fit.
283
+ /// If no key is given, all `Values ` will shrink to fit.
288
284
Fit ( Option < K > ) ,
289
- /// Reserves capacity for some number of additional elements in [`MaybeShallowCopied<V>alues `]
285
+ /// Reserves capacity for some number of additional elements in [`Values `]
290
286
/// for the given key. If the given key does not exist, allocate an empty
291
- /// `MaybeShallowCopied<V>alues ` with the given capacity.
287
+ /// `Values ` with the given capacity.
292
288
///
293
289
/// This can improve performance by pre-allocating space for large bags of values.
294
290
Reserve ( K , usize ) ,
295
291
/// Mark the map as ready to be consumed for readers.
296
292
MarkReady ,
297
293
/// Set the value of the map meta.
298
294
SetMeta ( M ) ,
295
+ /// Copy over the contents of the read map wholesale as the write map is empty.
296
+ JustCloneRHandle ,
299
297
}
300
298
301
299
impl < K , V , M > fmt:: Debug for Operation < K , V , M >
302
300
where
303
301
K : fmt:: Debug ,
304
- V : ShallowCopy + fmt:: Debug ,
305
- V :: Target : fmt:: Debug ,
302
+ V : fmt:: Debug ,
306
303
M : fmt:: Debug ,
307
304
{
308
305
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -320,6 +317,7 @@ where
320
317
Operation :: Reserve ( ref a, ref b) => f. debug_tuple ( "Reserve" ) . field ( a) . field ( b) . finish ( ) ,
321
318
Operation :: MarkReady => f. debug_tuple ( "MarkReady" ) . finish ( ) ,
322
319
Operation :: SetMeta ( ref a) => f. debug_tuple ( "SetMeta" ) . field ( a) . finish ( ) ,
320
+ Operation :: JustCloneRHandle => f. debug_tuple ( "JustCloneRHandle" ) . finish ( ) ,
323
321
}
324
322
}
325
323
}
@@ -400,8 +398,7 @@ where
400
398
where
401
399
K : Eq + Hash + Clone ,
402
400
S : BuildHasher + Clone ,
403
- V : ShallowCopy ,
404
- V :: Target : Eq + Hash ,
401
+ V : Eq + Hash ,
405
402
M : ' static + Clone ,
406
403
{
407
404
let inner = if let Some ( cap) = self . capacity {
@@ -427,8 +424,7 @@ pub fn new<K, V>() -> (
427
424
)
428
425
where
429
426
K : Eq + Hash + Clone ,
430
- V : ShallowCopy ,
431
- V :: Target : Eq + Hash ,
427
+ V : Eq + Hash ,
432
428
{
433
429
Options :: default ( ) . construct ( )
434
430
}
@@ -445,8 +441,7 @@ pub fn with_meta<K, V, M>(
445
441
)
446
442
where
447
443
K : Eq + Hash + Clone ,
448
- V : ShallowCopy ,
449
- V :: Target : Eq + Hash ,
444
+ V : Eq + Hash ,
450
445
M : ' static + Clone ,
451
446
{
452
447
Options :: default ( ) . with_meta ( meta) . construct ( )
@@ -462,8 +457,7 @@ pub fn with_hasher<K, V, M, S>(
462
457
) -> ( WriteHandle < K , V , M , S > , ReadHandle < K , V , M , S > )
463
458
where
464
459
K : Eq + Hash + Clone ,
465
- V : ShallowCopy ,
466
- V :: Target : Eq + Hash ,
460
+ V : Eq + Hash ,
467
461
M : ' static + Clone ,
468
462
S : BuildHasher + Clone ,
469
463
{
0 commit comments