gio/auto/
settings_schema_key.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10    pub struct SettingsSchemaKey(Shared<ffi::GSettingsSchemaKey>);
11
12    match fn {
13        ref => |ptr| ffi::g_settings_schema_key_ref(ptr),
14        unref => |ptr| ffi::g_settings_schema_key_unref(ptr),
15        type_ => || ffi::g_settings_schema_key_get_type(),
16    }
17}
18
19impl SettingsSchemaKey {
20    #[doc(alias = "g_settings_schema_key_get_default_value")]
21    #[doc(alias = "get_default_value")]
22    pub fn default_value(&self) -> glib::Variant {
23        unsafe {
24            from_glib_full(ffi::g_settings_schema_key_get_default_value(
25                self.to_glib_none().0,
26            ))
27        }
28    }
29
30    #[doc(alias = "g_settings_schema_key_get_description")]
31    #[doc(alias = "get_description")]
32    pub fn description(&self) -> Option<glib::GString> {
33        unsafe {
34            from_glib_none(ffi::g_settings_schema_key_get_description(
35                self.to_glib_none().0,
36            ))
37        }
38    }
39
40    #[doc(alias = "g_settings_schema_key_get_name")]
41    #[doc(alias = "get_name")]
42    pub fn name(&self) -> glib::GString {
43        unsafe { from_glib_none(ffi::g_settings_schema_key_get_name(self.to_glib_none().0)) }
44    }
45
46    #[doc(alias = "g_settings_schema_key_get_range")]
47    #[doc(alias = "get_range")]
48    pub fn range(&self) -> glib::Variant {
49        unsafe { from_glib_full(ffi::g_settings_schema_key_get_range(self.to_glib_none().0)) }
50    }
51
52    #[doc(alias = "g_settings_schema_key_get_summary")]
53    #[doc(alias = "get_summary")]
54    pub fn summary(&self) -> Option<glib::GString> {
55        unsafe {
56            from_glib_none(ffi::g_settings_schema_key_get_summary(
57                self.to_glib_none().0,
58            ))
59        }
60    }
61
62    #[doc(alias = "g_settings_schema_key_get_value_type")]
63    #[doc(alias = "get_value_type")]
64    pub fn value_type(&self) -> glib::VariantType {
65        unsafe {
66            from_glib_none(ffi::g_settings_schema_key_get_value_type(
67                self.to_glib_none().0,
68            ))
69        }
70    }
71
72    #[doc(alias = "g_settings_schema_key_range_check")]
73    pub fn range_check(&self, value: &glib::Variant) -> bool {
74        unsafe {
75            from_glib(ffi::g_settings_schema_key_range_check(
76                self.to_glib_none().0,
77                value.to_glib_none().0,
78            ))
79        }
80    }
81}
82
83impl std::fmt::Display for SettingsSchemaKey {
84    #[inline]
85    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
86        f.write_str(&self.name())
87    }
88}