gio_unix/auto/
mount_entry.rs1use crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug)]
12 pub struct MountEntry(Boxed<ffi::GUnixMountEntry>);
13
14 match fn {
15 copy => |ptr| ffi::g_unix_mount_entry_copy(ptr),
16 free => |ptr| ffi::g_unix_mount_entry_free(ptr),
17 type_ => || ffi::g_unix_mount_entry_get_type(),
18 }
19}
20
21impl MountEntry {
22 #[doc(alias = "g_unix_mount_entry_compare")]
23 fn compare(&self, mount2: &MountEntry) -> i32 {
24 unsafe {
25 ffi::g_unix_mount_entry_compare(
26 mut_override(self.to_glib_none().0),
27 mut_override(mount2.to_glib_none().0),
28 )
29 }
30 }
31
32 #[doc(alias = "g_unix_mount_entry_get_device_path")]
38 #[doc(alias = "get_device_path")]
39 pub fn device_path(&self) -> std::path::PathBuf {
40 unsafe {
41 from_glib_none(ffi::g_unix_mount_entry_get_device_path(mut_override(
42 self.to_glib_none().0,
43 )))
44 }
45 }
46
47 #[doc(alias = "g_unix_mount_entry_get_fs_type")]
53 #[doc(alias = "get_fs_type")]
54 pub fn fs_type(&self) -> glib::GString {
55 unsafe {
56 from_glib_none(ffi::g_unix_mount_entry_get_fs_type(mut_override(
57 self.to_glib_none().0,
58 )))
59 }
60 }
61
62 #[doc(alias = "g_unix_mount_entry_get_mount_path")]
68 #[doc(alias = "get_mount_path")]
69 pub fn mount_path(&self) -> std::path::PathBuf {
70 unsafe {
71 from_glib_none(ffi::g_unix_mount_entry_get_mount_path(mut_override(
72 self.to_glib_none().0,
73 )))
74 }
75 }
76
77 #[doc(alias = "g_unix_mount_entry_get_options")]
89 #[doc(alias = "get_options")]
90 pub fn options(&self) -> Option<glib::GString> {
91 unsafe {
92 from_glib_none(ffi::g_unix_mount_entry_get_options(mut_override(
93 self.to_glib_none().0,
94 )))
95 }
96 }
97
98 #[doc(alias = "g_unix_mount_entry_get_root_path")]
109 #[doc(alias = "get_root_path")]
110 pub fn root_path(&self) -> Option<glib::GString> {
111 unsafe {
112 from_glib_none(ffi::g_unix_mount_entry_get_root_path(mut_override(
113 self.to_glib_none().0,
114 )))
115 }
116 }
117
118 #[doc(alias = "g_unix_mount_entry_guess_can_eject")]
124 pub fn guess_can_eject(&self) -> bool {
125 unsafe {
126 from_glib(ffi::g_unix_mount_entry_guess_can_eject(mut_override(
127 self.to_glib_none().0,
128 )))
129 }
130 }
131
132 #[doc(alias = "g_unix_mount_entry_guess_icon")]
138 pub fn guess_icon(&self) -> gio::Icon {
139 unsafe {
140 from_glib_full(ffi::g_unix_mount_entry_guess_icon(mut_override(
141 self.to_glib_none().0,
142 )))
143 }
144 }
145
146 #[doc(alias = "g_unix_mount_entry_guess_name")]
154 pub fn guess_name(&self) -> glib::GString {
155 unsafe {
156 from_glib_full(ffi::g_unix_mount_entry_guess_name(mut_override(
157 self.to_glib_none().0,
158 )))
159 }
160 }
161
162 #[doc(alias = "g_unix_mount_entry_guess_should_display")]
168 pub fn guess_should_display(&self) -> bool {
169 unsafe {
170 from_glib(ffi::g_unix_mount_entry_guess_should_display(mut_override(
171 self.to_glib_none().0,
172 )))
173 }
174 }
175
176 #[doc(alias = "g_unix_mount_entry_guess_symbolic_icon")]
182 pub fn guess_symbolic_icon(&self) -> gio::Icon {
183 unsafe {
184 from_glib_full(ffi::g_unix_mount_entry_guess_symbolic_icon(mut_override(
185 self.to_glib_none().0,
186 )))
187 }
188 }
189
190 #[doc(alias = "g_unix_mount_entry_is_readonly")]
196 pub fn is_readonly(&self) -> bool {
197 unsafe {
198 from_glib(ffi::g_unix_mount_entry_is_readonly(mut_override(
199 self.to_glib_none().0,
200 )))
201 }
202 }
203
204 #[doc(alias = "g_unix_mount_entry_is_system_internal")]
211 pub fn is_system_internal(&self) -> bool {
212 unsafe {
213 from_glib(ffi::g_unix_mount_entry_is_system_internal(mut_override(
214 self.to_glib_none().0,
215 )))
216 }
217 }
218
219 #[doc(alias = "g_unix_mount_entry_at")]
239 #[doc(alias = "at")]
240 pub fn for_mount_path(mount_path: impl AsRef<std::path::Path>) -> (Option<MountEntry>, u64) {
241 unsafe {
242 let mut time_read = std::mem::MaybeUninit::uninit();
243 let ret = from_glib_full(ffi::g_unix_mount_entry_at(
244 mount_path.as_ref().to_glib_none().0,
245 time_read.as_mut_ptr(),
246 ));
247 (ret, time_read.assume_init())
248 }
249 }
250
251 #[doc(alias = "g_unix_mount_entry_for")]
262 #[doc(alias = "for")]
263 pub fn for_file_path(file_path: impl AsRef<std::path::Path>) -> (Option<MountEntry>, u64) {
264 unsafe {
265 let mut time_read = std::mem::MaybeUninit::uninit();
266 let ret = from_glib_full(ffi::g_unix_mount_entry_for(
267 file_path.as_ref().to_glib_none().0,
268 time_read.as_mut_ptr(),
269 ));
270 (ret, time_read.assume_init())
271 }
272 }
273}
274
275impl PartialEq for MountEntry {
276 #[inline]
277 fn eq(&self, other: &Self) -> bool {
278 self.compare(other) == 0
279 }
280}
281
282impl Eq for MountEntry {}
283
284impl PartialOrd for MountEntry {
285 #[inline]
286 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
287 Some(self.cmp(other))
288 }
289}
290
291impl Ord for MountEntry {
292 #[inline]
293 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
294 self.compare(other).cmp(&0)
295 }
296}
297
298unsafe impl Send for MountEntry {}
299unsafe impl Sync for MountEntry {}