pub unsafe trait AllocatorClone: Allocator + Clone { }allocator_api #32838)Expand description
Marks a type’s Clone implementation as sound with regard to Allocator equivalence.
Implementors must ensure that, upon cloning, the two allocators are equivalent
(i.e. it is possible to free memory with one that was allocated with the other).
Further, mutable accesses such as moving or dropping the allocator must not invalidate
its currently allocated blocks at least so long as clones exist.
Additionally, the bound that allocators do not unwind when (de)allocating also applies to guaranteeing allocators will not unwind when cloned.
It must also be the case that types which are AllocatorClone are either explicitly not
copyable (such as by containing a !Copy field) or that copying them also respects allocator
equivalence as if it had been a clone.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".