1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use glib::translate::*;
use glib::Type;
use std::fmt;
use std::ptr;
#[doc(alias = "GIOExtension")]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IOExtension(ptr::NonNull<ffi::GIOExtension>);
impl fmt::Debug for IOExtension {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("IOExtension")
.field("name", &self.name())
.field("priority", &self.priority())
.field("type", &self.type_())
.finish()
}
}
impl fmt::Display for IOExtension {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "IOExtension")
}
}
impl FromGlibPtrNone<*mut ffi::GIOExtension> for IOExtension {
#[inline]
unsafe fn from_glib_none(ptr: *mut ffi::GIOExtension) -> Self {
assert!(!ptr.is_null());
IOExtension(ptr::NonNull::new_unchecked(ptr))
}
}
impl<'a> ToGlibPtr<'a, *mut ffi::GIOExtension> for &'a IOExtension {
type Storage = &'a IOExtension;
#[inline]
fn to_glib_none(&self) -> Stash<'a, *mut ffi::GIOExtension, &'a IOExtension> {
Stash(self.0.as_ptr() as *mut ffi::GIOExtension, *self)
}
}
impl IOExtension {
#[doc(alias = "g_io_extension_get_name")]
pub fn name(&self) -> glib::GString {
unsafe { from_glib_none(ffi::g_io_extension_get_name(self.0.as_ptr())) }
}
#[doc(alias = "g_io_extension_get_priority")]
pub fn priority(&self) -> i32 {
unsafe { ffi::g_io_extension_get_priority(self.0.as_ptr()) }
}
#[doc(alias = "g_io_extension_get_type")]
pub fn type_(&self) -> Type {
unsafe { from_glib(ffi::g_io_extension_get_type(self.0.as_ptr())) }
}
}