glib/gobject/
type_info.rs1use crate::gobject_ffi;
4
5#[derive(Debug, Copy, Clone)]
6#[doc(alias = "GTypeInfo")]
7#[repr(transparent)]
8pub struct TypeInfo(pub(crate) gobject_ffi::GTypeInfo);
9
10impl TypeInfo {
11 #[doc(hidden)]
14 #[inline]
15 pub fn as_ptr(&self) -> *mut gobject_ffi::GTypeInfo {
16 &self.0 as *const gobject_ffi::GTypeInfo as *mut _
17 }
18
19 #[doc(hidden)]
22 #[inline]
23 pub unsafe fn from_glib_ptr_borrow_mut<'a>(ptr: *mut gobject_ffi::GTypeInfo) -> &'a mut Self {
24 &mut *(ptr as *mut Self)
25 }
26}
27
28impl Default for TypeInfo {
29 fn default() -> Self {
32 Self(gobject_ffi::GTypeInfo {
33 class_size: 0u16,
34 base_init: None,
35 base_finalize: None,
36 class_init: None,
37 class_finalize: None,
38 class_data: ::std::ptr::null(),
39 instance_size: 0,
40 n_preallocs: 0,
41 instance_init: None,
42 value_table: ::std::ptr::null(),
43 })
44 }
45}