Derive Macro clone_fields::CloneFields
source · #[derive(CloneFields)]
{
// Attributes available to this derive:
#[destinations]
}
Expand description
A derive macro for CloneInto
and CloneFrom
traits.
To automagically derive the traits for your type against a DesiredTypeName
add the
following attributes to it:
#[derive(CloneFields)]
,- and
#[destinations("DesiredTypeName")]
.
… and the macro will generate an implementations of CloneInto<DesiredTypeName>
and
CloneFrom<DesiredTypeName>
for you type then.
You can add more than one type, like #[destinations("Type1", "Type2", ...)]
.
It is possible to use structs with fields with different types, the only requirement is that
respective types should be “clonable” with the CloneFrom
and CloneInto
traits.
Please refer to clone-fields docs for more info on why do you ;) implied you need it