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#[derive(Debug, Copy, Clone)]
6#[doc(alias = "GInterfaceInfo")]
7#[repr(transparent)]
8pub struct InterfaceInfo(pub(crate) gobject_ffi::GInterfaceInfo);
9
10impl InterfaceInfo {
11 // rustdoc-stripper-ignore-next
12 /// Returns a `GInterfaceInfo` pointer.
13 #[doc(hidden)]
14 #[inline]
15 pub fn as_ptr(&self) -> *mut gobject_ffi::GInterfaceInfo {
16 &self.0 as *const gobject_ffi::GInterfaceInfo as *mut _
17 }
18
19 // rustdoc-stripper-ignore-next
20 /// Borrows the underlying C value mutably.
21 #[doc(hidden)]
22 #[inline]
23 pub unsafe fn from_glib_ptr_borrow_mut<'a>(
24 ptr: *mut gobject_ffi::GInterfaceInfo,
25 ) -> &'a mut Self {
26 &mut *(ptr as *mut Self)
27 }
28}
29
30impl Default for InterfaceInfo {
31 // rustdoc-stripper-ignore-next
32 /// Creates a new InterfaceInfo with default value.
33 fn default() -> Self {
34 Self(gobject_ffi::GInterfaceInfo {
35 interface_init: None,
36 interface_finalize: None,
37 interface_data: ::std::ptr::null_mut(),
38 })
39 }
40}