Clone trait that is object-safe
This crate provides a Clone trait that can be used in trait objects, and a
clone_box function that can clone any sized or dynamically sized
implementation of Clone. Types that implement the standard library's
std::clone::Clone trait are automatically usable this way.
The signature of clone_box is:
Example
This crate includes a macro for concisely implementing impl std::clone::Clone for Box<MyTrait> in terms of objekt::clone_box.
// As before.
clone_trait_object!;
// Now data structures containing Box<MyTrait> can derive Clone: