@@ -47,6 +47,7 @@ macro_rules! glib_boxed_wrapper {
47
47
48
48
#[ doc = "Borrows the underlying C value." ]
49
49
#[ inline]
50
+ #[ deprecated = "Use FromGlibBorrow2 trait" ]
50
51
pub unsafe fn from_glib_ptr_borrow( ptr: & * mut $ffi_name) -> & Self {
51
52
debug_assert_eq!(
52
53
std:: mem:: size_of:: <Self >( ) ,
@@ -58,6 +59,7 @@ macro_rules! glib_boxed_wrapper {
58
59
59
60
#[ doc = "Borrows the underlying C value mutably." ]
60
61
#[ inline]
62
+ #[ deprecated = "Use FromGlibBorrowMut2 trait" ]
61
63
pub unsafe fn from_glib_ptr_borrow_mut( ptr: & mut * mut $ffi_name) -> & mut Self {
62
64
debug_assert_eq!(
63
65
std:: mem:: size_of:: <Self >( ) ,
@@ -252,6 +254,45 @@ macro_rules! glib_boxed_wrapper {
252
254
}
253
255
}
254
256
257
+ #[ doc( hidden) ]
258
+ impl $( <$( $generic $( : $bound $( + $bound2) * ) ?) ,+>) ? $crate:: translate:: FromGlibPtrBorrow2 <* mut $ffi_name> for $name $( <$( $generic) ,+>) ? {
259
+ #[ inline]
260
+ unsafe fn from_glib_borrow2( ptr: & * mut $ffi_name) -> & Self {
261
+ debug_assert_eq!(
262
+ std:: mem:: size_of:: <Self >( ) ,
263
+ std:: mem:: size_of:: <$crate:: ffi:: gpointer>( )
264
+ ) ;
265
+ debug_assert!( !ptr. is_null( ) ) ;
266
+ & * ( ptr as * const * mut $ffi_name as * const Self )
267
+ }
268
+ }
269
+
270
+ #[ doc( hidden) ]
271
+ impl $( <$( $generic $( : $bound $( + $bound2) * ) ?) ,+>) ? $crate:: translate:: FromGlibPtrBorrow2 <* const $ffi_name> for $name $( <$( $generic) ,+>) ? {
272
+ #[ inline]
273
+ unsafe fn from_glib_borrow2( ptr: & * const $ffi_name) -> & Self {
274
+ debug_assert_eq!(
275
+ std:: mem:: size_of:: <Self >( ) ,
276
+ std:: mem:: size_of:: <$crate:: ffi:: gpointer>( )
277
+ ) ;
278
+ debug_assert!( !ptr. is_null( ) ) ;
279
+ & * ( ptr as * const * const $ffi_name as * const Self )
280
+ }
281
+ }
282
+
283
+ #[ doc( hidden) ]
284
+ impl $( <$( $generic $( : $bound $( + $bound2) * ) ?) ,+>) ? $crate:: translate:: FromGlibPtrBorrowMut2 <* mut $ffi_name> for $name $( <$( $generic) ,+>) ? {
285
+ #[ inline]
286
+ unsafe fn from_glib_borrow_mut2( ptr: & mut * mut $ffi_name) -> & mut Self {
287
+ debug_assert_eq!(
288
+ std:: mem:: size_of:: <Self >( ) ,
289
+ std:: mem:: size_of:: <$crate:: ffi:: gpointer>( )
290
+ ) ;
291
+ debug_assert!( !ptr. is_null( ) ) ;
292
+ & mut * ( ptr as * mut * mut $ffi_name as * mut Self )
293
+ }
294
+ }
295
+
255
296
#[ doc( hidden) ]
256
297
impl $( <$( $generic $( : $bound $( + $bound2) * ) ?) ,+>) ? $crate:: translate:: FromGlibContainerAsVec <* mut $ffi_name, * mut * mut $ffi_name> for $name $( <$( $generic) ,+>) ? {
257
298
unsafe fn from_glib_none_num_as_vec( ptr: * mut * mut $ffi_name, num: usize ) -> Vec <Self > {
@@ -363,7 +404,7 @@ macro_rules! glib_boxed_wrapper {
363
404
#[ inline]
364
405
unsafe fn from_value( value: & ' a $crate:: Value ) -> Self {
365
406
let value = & * ( value as * const $crate:: Value as * const $crate:: gobject_ffi:: GValue ) ;
366
- <$name $( <$( $generic) ,+>) ?> :: from_glib_ptr_borrow ( & * ( & value. data[ 0 ] . v_pointer as * const $crate:: ffi:: gpointer as * const * mut $ffi_name) )
407
+ <$name $( <$( $generic) ,+>) ? as $crate :: translate :: FromGlibPtrBorrow2 < * mut $ffi_name>> :: from_glib_borrow2 ( & * ( & value. data[ 0 ] . v_pointer as * const $crate:: ffi:: gpointer as * const * mut $ffi_name) )
367
408
}
368
409
}
369
410
0 commit comments