File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,8 @@ mod foo {
149
149
overridden : PhantomData < u32 > ,
150
150
#[ property( get, set) ]
151
151
weak_ref_prop : glib:: WeakRef < glib:: Object > ,
152
+ #[ property( get, set) ]
153
+ send_weak_ref_prop : glib:: SendWeakRef < glib:: Object > ,
152
154
}
153
155
154
156
impl ObjectImpl for Foo {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use std::sync::RwLock;
12
12
use crate :: HasParamSpec ;
13
13
use crate :: IsA ;
14
14
use crate :: Object ;
15
+ use crate :: SendWeakRef ;
15
16
use crate :: WeakRef ;
16
17
17
18
// rustdoc-stripper-ignore-next
@@ -56,6 +57,9 @@ impl<T: Property> Property for Arc<T> {
56
57
impl < T : IsA < Object > + HasParamSpec > Property for WeakRef < T > {
57
58
type Value = Option < T > ;
58
59
}
60
+ impl < T : IsA < Object > + HasParamSpec > Property for SendWeakRef < T > {
61
+ type Value = Option < T > ;
62
+ }
59
63
60
64
// rustdoc-stripper-ignore-next
61
65
/// A container type implementing this trait can be read by the default getter generated by the `Props` macro.
@@ -189,6 +193,20 @@ impl<T: IsA<Object>> PropertySet for WeakRef<T> {
189
193
self . set ( v. as_ref ( ) )
190
194
}
191
195
}
196
+ impl < T : IsA < Object > > PropertyGet for SendWeakRef < T > {
197
+ type Value = Option < T > ;
198
+
199
+ fn get < R , F : Fn ( & Self :: Value ) -> R > ( & self , f : F ) -> R {
200
+ f ( & self . upgrade ( ) )
201
+ }
202
+ }
203
+ impl < T : IsA < Object > > PropertySet for SendWeakRef < T > {
204
+ type SetValue = Option < T > ;
205
+
206
+ fn set ( & self , v : Self :: SetValue ) {
207
+ WeakRef :: set ( self , v. as_ref ( ) ) ;
208
+ }
209
+ }
192
210
193
211
// Smart pointers wrapping a `PropertyRead`/`PropertyWrite`
194
212
impl < T : PropertyGet > PropertyGet for Rc < T > {
You can’t perform that action at this time.
0 commit comments