[−][src]Derive Macro enso_shapely_macros::CloneRef
#[derive(CloneRef)] { // Attributes available to this derive: #[clone_ref] }
Derives CloneRef
implementation for given type. It performs clone_ref
on every member
field. The input type must implement Clone
and its every field must implement CloneRef
.
For generic types no bounds are introduced in the generated implementation. To customize this
behavior user might add #[clone_ref(bound="…")]
attribute. Then the generated implementation
will use the provided bounds.
Moreover, for a given struct X
this macro generates also impl From<&X> for X
which uses
CloneRef
under the hood. The semantics of CloneRef
makes each object to naturally provide
transformation from reference to an owned type.
Supported inputs are structs (unit, named, unnamed), enums (with unit, named, unnamed and no variants at all). Unions are currently not supported.