1 // Take a look at the license at the top of the repository in the LICENSE file. 2 3 use glib::translate::*; 4 use std::mem; 5 6 #[repr(C)] 7 pub struct Requisition { 8 pub width: i32, 9 pub height: i32, 10 } 11 12 #[doc(hidden)] 13 impl Uninitialized for Requisition { 14 #[inline] uninitialized() -> Self15 unsafe fn uninitialized() -> Self { 16 mem::zeroed() 17 } 18 } 19 20 #[doc(hidden)] 21 impl<'a> ToGlibPtr<'a, *const ffi::GtkRequisition> for Requisition { 22 type Storage = &'a Self; 23 24 #[inline] to_glib_none(&'a self) -> Stash<'a, *const ffi::GtkRequisition, Self>25 fn to_glib_none(&'a self) -> Stash<'a, *const ffi::GtkRequisition, Self> { 26 let ptr: *const Requisition = &*self; 27 Stash(ptr as *const ffi::GtkRequisition, self) 28 } 29 } 30 31 #[doc(hidden)] 32 impl<'a> ToGlibPtrMut<'a, *mut ffi::GtkRequisition> for Requisition { 33 type Storage = &'a mut Self; 34 35 #[inline] to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::GtkRequisition, Self>36 fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::GtkRequisition, Self> { 37 let ptr: *mut Requisition = &mut *self; 38 StashMut(ptr as *mut ffi::GtkRequisition, self) 39 } 40 } 41