glib/gobject/interface_info.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::gobject_ffi;
4
5/// A structure that provides information to the type system which is
6/// used specifically for managing interface types.
7#[derive(Debug, Copy, Clone)]
8#[doc(alias = "GInterfaceInfo")]
9#[repr(transparent)]
10pub struct InterfaceInfo(pub(crate) gobject_ffi::GInterfaceInfo);
11
12impl InterfaceInfo {
13 // rustdoc-stripper-ignore-next
14 /// Returns a `GInterfaceInfo` pointer.
15 #[doc(hidden)]
16 #[inline]
17 pub fn as_ptr(&self) -> *mut gobject_ffi::GInterfaceInfo {
18 &self.0 as *const gobject_ffi::GInterfaceInfo as *mut _
19 }
20
21 // rustdoc-stripper-ignore-next
22 /// Borrows the underlying C value mutably.
23 #[doc(hidden)]
24 #[inline]
25 pub unsafe fn from_glib_ptr_borrow_mut<'a>(
26 ptr: *mut gobject_ffi::GInterfaceInfo,
27 ) -> &'a mut Self {
28 &mut *(ptr as *mut Self)
29 }
30}
31
32impl Default for InterfaceInfo {
33 // rustdoc-stripper-ignore-next
34 /// Creates a new InterfaceInfo with default value.
35 fn default() -> Self {
36 Self(gobject_ffi::GInterfaceInfo {
37 interface_init: None,
38 interface_finalize: None,
39 interface_data: ::std::ptr::null_mut(),
40 })
41 }
42}