@@ -362,12 +362,12 @@ pub trait ToValue {
362
362
fn to_value_type ( & self ) -> Type ;
363
363
}
364
364
365
- impl < ' a , T : ? Sized + SetValueOptional > ToValue for Option < & ' a T > {
365
+ impl < T : SetValueOptional > ToValue for Option < T > {
366
366
fn to_value ( & self ) -> Value {
367
367
unsafe {
368
368
let mut ret = Value :: uninitialized ( ) ;
369
369
gobject_ffi:: g_value_init ( ret. to_glib_none_mut ( ) . 0 , T :: static_type ( ) . to_glib ( ) ) ;
370
- T :: set_value_optional ( & mut ret, self . clone ( ) ) ;
370
+ T :: set_value_optional ( & mut ret, self . as_ref ( ) ) ;
371
371
ret
372
372
}
373
373
}
@@ -448,15 +448,15 @@ impl SetValueOptional for str {
448
448
}
449
449
}
450
450
451
- impl < ' a > SetValue for & ' a str {
451
+ impl < ' a , T : ? Sized + SetValue > SetValue for & ' a T {
452
452
unsafe fn set_value ( value : & mut Value , this : & Self ) {
453
- gobject_ffi :: g_value_take_string ( value. to_glib_none_mut ( ) . 0 , this. to_glib_full ( ) )
453
+ SetValue :: set_value ( value, * this)
454
454
}
455
455
}
456
456
457
- impl < ' a > SetValueOptional for & ' a str {
457
+ impl < ' a , T : ? Sized + SetValueOptional > SetValueOptional for & ' a T {
458
458
unsafe fn set_value_optional ( value : & mut Value , this : Option < & Self > ) {
459
- gobject_ffi :: g_value_take_string ( value. to_glib_none_mut ( ) . 0 , this. to_glib_full ( ) )
459
+ SetValueOptional :: set_value_optional ( value, this. map ( |v| * v ) )
460
460
}
461
461
}
462
462
@@ -491,12 +491,6 @@ impl<T: IsA<Object>> SetValueOptional for T {
491
491
}
492
492
}
493
493
494
- impl < ' a , T : IsA < Object > > SetValue for & ' a T {
495
- unsafe fn set_value ( value : & mut Value , this : & Self ) {
496
- gobject_ffi:: g_value_set_object ( value. to_glib_none_mut ( ) . 0 , this. to_glib_none ( ) . 0 )
497
- }
498
- }
499
-
500
494
impl FromValueOptional for bool {
501
495
unsafe fn from_value_optional ( value : & Value ) -> Option < Self > {
502
496
Some ( from_glib ( gobject_ffi:: g_value_get_boolean ( value. to_glib_none ( ) . 0 ) ) )
0 commit comments