Function clone

Source
pub fn clone<T>(src: &T) -> T
where T: CloneDyn,
Expand description

Reusing main crate.

True clone which is applicable not only to clonable entities, but to trait objects implementing CloneDyn.

ยงExample

use clone_dyn_types::clone;

#[ derive( Clone ) ]
struct MyStruct
{
  value : i32,
}

let original = MyStruct { value : 42 };
let cloned = clone( &original );

assert_eq!( original.value, cloned.value );