File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
itest/rust/src/object_tests Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 67
67
}
68
68
}
69
69
70
+ impl < T , U > AsObjectArg < T > for & mut Gd < U >
71
+ where
72
+ T : GodotClass + Bounds < Declarer = bounds:: DeclEngine > ,
73
+ U : Inherits < T > ,
74
+ {
75
+ // Delegate to &Gd impl.
76
+
77
+ fn as_object_arg ( & self ) -> ObjectArg < T > {
78
+ <& Gd < U > >:: as_object_arg ( & & * * self )
79
+ }
80
+
81
+ fn consume_object ( self ) -> ObjectCow < T > {
82
+ <& Gd < U > >:: consume_object ( & * self )
83
+ }
84
+ }
85
+
70
86
impl < T , U > AsObjectArg < T > for Option < U >
71
87
where
72
88
T : GodotClass + Bounds < Declarer = bounds:: DeclEngine > ,
Original file line number Diff line number Diff line change @@ -33,6 +33,16 @@ fn object_arg_borrowed() {
33
33
} ) ;
34
34
}
35
35
36
+ #[ itest]
37
+ fn object_arg_borrowed_mut ( ) {
38
+ with_objects ( |mut manual, mut refc| {
39
+ let db = ClassDb :: singleton ( ) ;
40
+ let a = db. class_set_property ( & mut manual, "name" . into ( ) , Variant :: from ( "hello" ) ) ;
41
+ let b = db. class_set_property ( & mut refc, "value" . into ( ) , Variant :: from ( -123 ) ) ;
42
+ ( a, b)
43
+ } ) ;
44
+ }
45
+
36
46
#[ itest]
37
47
fn object_arg_option_owned ( ) {
38
48
with_objects ( |manual, refc| {
@@ -53,6 +63,16 @@ fn object_arg_option_borrowed() {
53
63
} ) ;
54
64
}
55
65
66
+ #[ itest]
67
+ fn object_arg_option_borrowed_mut ( ) {
68
+ with_objects ( |mut manual, mut refc| {
69
+ let db = ClassDb :: singleton ( ) ;
70
+ let a = db. class_set_property ( Some ( & mut manual) , "name" . into ( ) , Variant :: from ( "hello" ) ) ;
71
+ let b = db. class_set_property ( Some ( & mut refc) , "value" . into ( ) , Variant :: from ( -123 ) ) ;
72
+ ( a, b)
73
+ } ) ;
74
+ }
75
+
56
76
#[ itest]
57
77
fn object_arg_option_none ( ) {
58
78
let manual: Option < Gd < Node > > = None ;
You can’t perform that action at this time.
0 commit comments