diff --git a/gdnative-core/src/core_types/dictionary.rs b/gdnative-core/src/core_types/dictionary.rs index beb64dce2..b487f705a 100644 --- a/gdnative-core/src/core_types/dictionary.rs +++ b/gdnative-core/src/core_types/dictionary.rs @@ -544,6 +544,12 @@ where } } +impl Clone for Dictionary { + fn clone(&self) -> Self { + self.new_ref() + } +} + godot_test!(test_dictionary { use std::collections::HashSet; diff --git a/gdnative-core/src/core_types/node_path.rs b/gdnative-core/src/core_types/node_path.rs index 260744a76..7ac024aed 100644 --- a/gdnative-core/src/core_types/node_path.rs +++ b/gdnative-core/src/core_types/node_path.rs @@ -176,3 +176,10 @@ impl fmt::Debug for NodePath { write!(f, "NodePath({})", self.to_string()) } } + +impl Clone for NodePath { + #[inline] + fn clone(&self) -> Self { + self.new_ref() + } +} diff --git a/gdnative-core/src/core_types/rect2.rs b/gdnative-core/src/core_types/rect2.rs index 1fe015688..0328f8190 100644 --- a/gdnative-core/src/core_types/rect2.rs +++ b/gdnative-core/src/core_types/rect2.rs @@ -1,5 +1,6 @@ use super::Vector2; +#[derive(Copy, Clone, Debug, PartialEq)] #[repr(C)] pub struct Rect2 { pub position: Vector2, diff --git a/gdnative-core/src/core_types/transform2d.rs b/gdnative-core/src/core_types/transform2d.rs index a8067908e..f2757e4b9 100644 --- a/gdnative-core/src/core_types/transform2d.rs +++ b/gdnative-core/src/core_types/transform2d.rs @@ -1,5 +1,6 @@ use super::Vector2; +#[derive(Copy, Clone, Debug, PartialEq)] #[repr(C)] pub struct Transform2D { pub x: Vector2, diff --git a/gdnative-core/src/core_types/variant.rs b/gdnative-core/src/core_types/variant.rs index e6ef9aef0..e9ad81f92 100644 --- a/gdnative-core/src/core_types/variant.rs +++ b/gdnative-core/src/core_types/variant.rs @@ -113,6 +113,7 @@ macro_rules! decl_variant_type { /// /// For `Variant`s containing objects, the original `Variant` is returned unchanged, due to /// the limitations of statically-determined memory management. + #[derive(Clone, Debug)] #[repr(u32)] pub enum VariantDispatch { $( diff --git a/gdnative-core/src/core_types/variant_array.rs b/gdnative-core/src/core_types/variant_array.rs index 48870fa02..135e65fe9 100644 --- a/gdnative-core/src/core_types/variant_array.rs +++ b/gdnative-core/src/core_types/variant_array.rs @@ -588,6 +588,12 @@ impl Extend for VariantArray } } +impl Clone for VariantArray { + fn clone(&self) -> Self { + self.new_ref() + } +} + godot_test!(test_array { let foo = Variant::from_str("foo"); let bar = Variant::from_str("bar");