gio_unix/auto/
mount_entry.rs1use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug)]
10 pub struct MountEntry(Boxed<ffi::GUnixMountEntry>);
11
12 match fn {
13 copy => |ptr| ffi::g_unix_mount_entry_copy(ptr),
14 free => |ptr| ffi::g_unix_mount_entry_free(ptr),
15 type_ => || ffi::g_unix_mount_entry_get_type(),
16 }
17}
18
19impl MountEntry {
20 #[doc(alias = "g_unix_mount_entry_compare")]
21 fn compare(&self, mount2: &MountEntry) -> i32 {
22 unsafe {
23 ffi::g_unix_mount_entry_compare(
24 mut_override(self.to_glib_none().0),
25 mut_override(mount2.to_glib_none().0),
26 )
27 }
28 }
29
30 #[doc(alias = "g_unix_mount_entry_get_device_path")]
31 #[doc(alias = "get_device_path")]
32 pub fn device_path(&self) -> std::path::PathBuf {
33 unsafe {
34 from_glib_none(ffi::g_unix_mount_entry_get_device_path(mut_override(
35 self.to_glib_none().0,
36 )))
37 }
38 }
39
40 #[doc(alias = "g_unix_mount_entry_get_fs_type")]
41 #[doc(alias = "get_fs_type")]
42 pub fn fs_type(&self) -> glib::GString {
43 unsafe {
44 from_glib_none(ffi::g_unix_mount_entry_get_fs_type(mut_override(
45 self.to_glib_none().0,
46 )))
47 }
48 }
49
50 #[doc(alias = "g_unix_mount_entry_get_mount_path")]
51 #[doc(alias = "get_mount_path")]
52 pub fn mount_path(&self) -> std::path::PathBuf {
53 unsafe {
54 from_glib_none(ffi::g_unix_mount_entry_get_mount_path(mut_override(
55 self.to_glib_none().0,
56 )))
57 }
58 }
59
60 #[doc(alias = "g_unix_mount_entry_get_options")]
61 #[doc(alias = "get_options")]
62 pub fn options(&self) -> Option<glib::GString> {
63 unsafe {
64 from_glib_none(ffi::g_unix_mount_entry_get_options(mut_override(
65 self.to_glib_none().0,
66 )))
67 }
68 }
69
70 #[doc(alias = "g_unix_mount_entry_get_root_path")]
71 #[doc(alias = "get_root_path")]
72 pub fn root_path(&self) -> Option<glib::GString> {
73 unsafe {
74 from_glib_none(ffi::g_unix_mount_entry_get_root_path(mut_override(
75 self.to_glib_none().0,
76 )))
77 }
78 }
79
80 #[doc(alias = "g_unix_mount_entry_guess_can_eject")]
81 pub fn guess_can_eject(&self) -> bool {
82 unsafe {
83 from_glib(ffi::g_unix_mount_entry_guess_can_eject(mut_override(
84 self.to_glib_none().0,
85 )))
86 }
87 }
88
89 #[doc(alias = "g_unix_mount_entry_guess_icon")]
90 pub fn guess_icon(&self) -> gio::Icon {
91 unsafe {
92 from_glib_full(ffi::g_unix_mount_entry_guess_icon(mut_override(
93 self.to_glib_none().0,
94 )))
95 }
96 }
97
98 #[doc(alias = "g_unix_mount_entry_guess_name")]
99 pub fn guess_name(&self) -> glib::GString {
100 unsafe {
101 from_glib_full(ffi::g_unix_mount_entry_guess_name(mut_override(
102 self.to_glib_none().0,
103 )))
104 }
105 }
106
107 #[doc(alias = "g_unix_mount_entry_guess_should_display")]
108 pub fn guess_should_display(&self) -> bool {
109 unsafe {
110 from_glib(ffi::g_unix_mount_entry_guess_should_display(mut_override(
111 self.to_glib_none().0,
112 )))
113 }
114 }
115
116 #[doc(alias = "g_unix_mount_entry_guess_symbolic_icon")]
117 pub fn guess_symbolic_icon(&self) -> gio::Icon {
118 unsafe {
119 from_glib_full(ffi::g_unix_mount_entry_guess_symbolic_icon(mut_override(
120 self.to_glib_none().0,
121 )))
122 }
123 }
124
125 #[doc(alias = "g_unix_mount_entry_is_readonly")]
126 pub fn is_readonly(&self) -> bool {
127 unsafe {
128 from_glib(ffi::g_unix_mount_entry_is_readonly(mut_override(
129 self.to_glib_none().0,
130 )))
131 }
132 }
133
134 #[doc(alias = "g_unix_mount_entry_is_system_internal")]
135 pub fn is_system_internal(&self) -> bool {
136 unsafe {
137 from_glib(ffi::g_unix_mount_entry_is_system_internal(mut_override(
138 self.to_glib_none().0,
139 )))
140 }
141 }
142
143 #[doc(alias = "g_unix_mount_entry_at")]
144 #[doc(alias = "at")]
145 pub fn for_mount_path(mount_path: impl AsRef<std::path::Path>) -> (Option<MountEntry>, u64) {
146 unsafe {
147 let mut time_read = std::mem::MaybeUninit::uninit();
148 let ret = from_glib_full(ffi::g_unix_mount_entry_at(
149 mount_path.as_ref().to_glib_none().0,
150 time_read.as_mut_ptr(),
151 ));
152 (ret, time_read.assume_init())
153 }
154 }
155
156 #[doc(alias = "g_unix_mount_entry_for")]
157 #[doc(alias = "for")]
158 pub fn for_file_path(file_path: impl AsRef<std::path::Path>) -> (Option<MountEntry>, u64) {
159 unsafe {
160 let mut time_read = std::mem::MaybeUninit::uninit();
161 let ret = from_glib_full(ffi::g_unix_mount_entry_for(
162 file_path.as_ref().to_glib_none().0,
163 time_read.as_mut_ptr(),
164 ));
165 (ret, time_read.assume_init())
166 }
167 }
168}
169
170impl PartialEq for MountEntry {
171 #[inline]
172 fn eq(&self, other: &Self) -> bool {
173 self.compare(other) == 0
174 }
175}
176
177impl Eq for MountEntry {}
178
179impl PartialOrd for MountEntry {
180 #[inline]
181 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
182 Some(self.cmp(other))
183 }
184}
185
186impl Ord for MountEntry {
187 #[inline]
188 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
189 self.compare(other).cmp(&0)
190 }
191}
192
193unsafe impl Send for MountEntry {}
194unsafe impl Sync for MountEntry {}