@@ -47,6 +47,7 @@ macro_rules! glib_boxed_wrapper {
4747
4848 #[ doc = "Borrows the underlying C value." ]
4949 #[ inline]
50+ #[ deprecated = "Use FromGlibBorrow2 trait" ]
5051 pub unsafe fn from_glib_ptr_borrow( ptr: & * mut $ffi_name) -> & Self {
5152 debug_assert_eq!(
5253 std:: mem:: size_of:: <Self >( ) ,
@@ -58,6 +59,7 @@ macro_rules! glib_boxed_wrapper {
5859
5960 #[ doc = "Borrows the underlying C value mutably." ]
6061 #[ inline]
62+ #[ deprecated = "Use FromGlibBorrowMut2 trait" ]
6163 pub unsafe fn from_glib_ptr_borrow_mut( ptr: & mut * mut $ffi_name) -> & mut Self {
6264 debug_assert_eq!(
6365 std:: mem:: size_of:: <Self >( ) ,
@@ -252,6 +254,45 @@ macro_rules! glib_boxed_wrapper {
252254 }
253255 }
254256
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+
255296 #[ doc( hidden) ]
256297 impl $( <$( $generic $( : $bound $( + $bound2) * ) ?) ,+>) ? $crate:: translate:: FromGlibContainerAsVec <* mut $ffi_name, * mut * mut $ffi_name> for $name $( <$( $generic) ,+>) ? {
257298 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 {
363404 #[ inline]
364405 unsafe fn from_value( value: & ' a $crate:: Value ) -> Self {
365406 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) )
367408 }
368409 }
369410
0 commit comments