glib/gobject/
type_plugin.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{gobject_ffi, prelude::*, translate::*, InterfaceInfo, TypeInfo, TypeValueTable};
4
5crate::wrapper! {
6    #[doc(alias = "GTypePlugin")]
7    pub struct TypePlugin(Interface<gobject_ffi::GTypePlugin, gobject_ffi::GTypePluginClass>);
8
9    match fn {
10        type_ => || gobject_ffi::g_type_plugin_get_type(),
11    }
12}
13
14impl TypePlugin {
15    pub const NONE: Option<&'static TypePlugin> = None;
16}
17
18pub trait TypePluginExt: IsA<TypePlugin> + 'static {
19    #[doc(alias = "g_type_plugin_complete_interface_info")]
20    fn complete_interface_info(
21        &self,
22        instance_type: crate::types::Type,
23        interface_type: crate::types::Type,
24    ) -> InterfaceInfo {
25        let info = InterfaceInfo::default();
26        unsafe {
27            gobject_ffi::g_type_plugin_complete_interface_info(
28                self.as_ref().to_glib_none().0,
29                instance_type.into_glib(),
30                interface_type.into_glib(),
31                info.as_ptr(),
32            );
33        }
34        info
35    }
36
37    #[doc(alias = "g_type_plugin_complete_type_info")]
38    fn complete_type_info(&self, g_type: crate::types::Type) -> (TypeInfo, TypeValueTable) {
39        let info = TypeInfo::default();
40        let value_table = TypeValueTable::default();
41        unsafe {
42            gobject_ffi::g_type_plugin_complete_type_info(
43                self.as_ref().to_glib_none().0,
44                g_type.into_glib(),
45                info.as_ptr(),
46                value_table.as_ptr(),
47            );
48        }
49        (info, value_table)
50    }
51
52    #[doc(alias = "g_type_plugin_unuse")]
53    fn unuse(&self) {
54        unsafe {
55            gobject_ffi::g_type_plugin_unuse(self.as_ref().to_glib_none().0);
56        }
57    }
58
59    #[doc(alias = "g_type_plugin_use")]
60    #[doc(alias = "use")]
61    fn use_(&self) {
62        unsafe {
63            gobject_ffi::g_type_plugin_use(self.as_ref().to_glib_none().0);
64        }
65    }
66}
67
68impl<O: IsA<TypePlugin>> TypePluginExt for O {}