clone_dyn_types 0.19.0

Derive to clone dyn structures.
Documentation

Module :: clone_dyn_types

experimental rust-status docs.rs Open in Gitpod discord

Derive to clone dyn structures.

It's types, use clone_dyn to avoid bolerplate.

By default, Rust does not support cloning for trait objects due to the Clone trait requiring compile-time knowledge of the type's size. The clone_dyn crate addresses this limitation through procedural macros, allowing for cloning collections of trait objects. Prefer to use clone_dyn instead of this crate, because clone_dyn includes this crate and also provides an attribute macro to generate boilerplate with one line of code.

Alternative

There are few alternatives dyn-clone, dyn-clonable. Unlike other options, this solution is more concise and demands less effort to use, all without compromising the quality of the outcome.

Basic use-case

To add to your project

cargo add clone_dyn_types

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/clone_dyn_types_trivial
cargo run