writeln!(w, "#[no_mangle]").unwrap();
writeln!(w, "/// Creates a new {} which has the same data as `orig`", mangled_container).unwrap();
writeln!(w, "/// but with all dynamically-allocated buffers duplicated in new buffers.").unwrap();
- writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{ orig.clone() }}", mangled_container, mangled_container, mangled_container).unwrap();
+ writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{ Clone::clone(&orig) }}", mangled_container, mangled_container, mangled_container).unwrap();
}
}
writeln!(w, "\tfn clone(&self) -> Self {{").unwrap();
writeln!(w, "\t\tSelf {{").unwrap();
for idx in 0..types.len() {
- writeln!(w, "\t\t\t{}: self.{}.clone(),", ('a' as u8 + idx as u8) as char, ('a' as u8 + idx as u8) as char).unwrap();
+ writeln!(w, "\t\t\t{}: Clone::clone(&self.{}),", ('a' as u8 + idx as u8) as char, ('a' as u8 + idx as u8) as char).unwrap();
}
writeln!(w, "\t\t}}").unwrap();
writeln!(w, "\t}}").unwrap();
writeln!(w, "#[no_mangle]").unwrap();
writeln!(w, "/// Creates a new tuple which has the same data as `orig`").unwrap();
writeln!(w, "/// but with all dynamically-allocated buffers duplicated in new buffers.").unwrap();
- writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{ orig.clone() }}", mangled_container, mangled_container, mangled_container).unwrap();
+ writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{ Clone::clone(&orig) }}", mangled_container, mangled_container, mangled_container).unwrap();
}
writeln!(w, "/// Creates a new {} from the contained elements.", mangled_container).unwrap();
writeln!(w, "#[no_mangle]").unwrap();
writeln!(w, "/// Creates a new {} which has the same data as `orig`", mangled_container).unwrap();
writeln!(w, "/// but with all dynamically-allocated buffers duplicated in new buffers.").unwrap();
- writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{ orig.clone() }}", mangled_container, mangled_container, mangled_container).unwrap();
+ writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{ Clone::clone(&orig) }}", mangled_container, mangled_container, mangled_container).unwrap();
}
}