gio/auto/
unix_mount_point.rs
1use crate::{ffi, Icon};
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug)]
12 pub struct UnixMountPoint(Boxed<ffi::GUnixMountPoint>);
13
14 match fn {
15 copy => |ptr| ffi::g_unix_mount_point_copy(mut_override(ptr)),
16 free => |ptr| ffi::g_unix_mount_point_free(ptr),
17 type_ => || ffi::g_unix_mount_point_get_type(),
18 }
19}
20
21impl UnixMountPoint {
22 #[doc(alias = "g_unix_mount_point_compare")]
23 fn compare(&self, mount2: &UnixMountPoint) -> i32 {
24 unsafe {
25 ffi::g_unix_mount_point_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_point_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_point_get_device_path(mut_override(
42 self.to_glib_none().0,
43 )))
44 }
45 }
46
47 #[doc(alias = "g_unix_mount_point_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_point_get_fs_type(mut_override(
57 self.to_glib_none().0,
58 )))
59 }
60 }
61
62 #[doc(alias = "g_unix_mount_point_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_point_get_mount_path(mut_override(
72 self.to_glib_none().0,
73 )))
74 }
75 }
76
77 #[doc(alias = "g_unix_mount_point_get_options")]
83 #[doc(alias = "get_options")]
84 pub fn options(&self) -> Option<glib::GString> {
85 unsafe {
86 from_glib_none(ffi::g_unix_mount_point_get_options(mut_override(
87 self.to_glib_none().0,
88 )))
89 }
90 }
91
92 #[doc(alias = "g_unix_mount_point_guess_can_eject")]
98 pub fn guess_can_eject(&self) -> bool {
99 unsafe {
100 from_glib(ffi::g_unix_mount_point_guess_can_eject(mut_override(
101 self.to_glib_none().0,
102 )))
103 }
104 }
105
106 #[doc(alias = "g_unix_mount_point_guess_icon")]
112 pub fn guess_icon(&self) -> Icon {
113 unsafe {
114 from_glib_full(ffi::g_unix_mount_point_guess_icon(mut_override(
115 self.to_glib_none().0,
116 )))
117 }
118 }
119
120 #[doc(alias = "g_unix_mount_point_guess_name")]
128 pub fn guess_name(&self) -> glib::GString {
129 unsafe {
130 from_glib_full(ffi::g_unix_mount_point_guess_name(mut_override(
131 self.to_glib_none().0,
132 )))
133 }
134 }
135
136 #[doc(alias = "g_unix_mount_point_guess_symbolic_icon")]
142 pub fn guess_symbolic_icon(&self) -> Icon {
143 unsafe {
144 from_glib_full(ffi::g_unix_mount_point_guess_symbolic_icon(mut_override(
145 self.to_glib_none().0,
146 )))
147 }
148 }
149
150 #[doc(alias = "g_unix_mount_point_is_loopback")]
156 pub fn is_loopback(&self) -> bool {
157 unsafe {
158 from_glib(ffi::g_unix_mount_point_is_loopback(mut_override(
159 self.to_glib_none().0,
160 )))
161 }
162 }
163
164 #[doc(alias = "g_unix_mount_point_is_readonly")]
170 pub fn is_readonly(&self) -> bool {
171 unsafe {
172 from_glib(ffi::g_unix_mount_point_is_readonly(mut_override(
173 self.to_glib_none().0,
174 )))
175 }
176 }
177
178 #[doc(alias = "g_unix_mount_point_is_user_mountable")]
184 pub fn is_user_mountable(&self) -> bool {
185 unsafe {
186 from_glib(ffi::g_unix_mount_point_is_user_mountable(mut_override(
187 self.to_glib_none().0,
188 )))
189 }
190 }
191
192 #[cfg(feature = "v2_66")]
211 #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
212 #[doc(alias = "g_unix_mount_point_at")]
213 pub fn at(mount_path: impl AsRef<std::path::Path>) -> (Option<UnixMountPoint>, u64) {
214 unsafe {
215 let mut time_read = std::mem::MaybeUninit::uninit();
216 let ret = from_glib_full(ffi::g_unix_mount_point_at(
217 mount_path.as_ref().to_glib_none().0,
218 time_read.as_mut_ptr(),
219 ));
220 (ret, time_read.assume_init())
221 }
222 }
223}
224
225impl PartialEq for UnixMountPoint {
226 #[inline]
227 fn eq(&self, other: &Self) -> bool {
228 self.compare(other) == 0
229 }
230}
231
232impl Eq for UnixMountPoint {}
233
234impl PartialOrd for UnixMountPoint {
235 #[inline]
236 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
237 Some(self.cmp(other))
238 }
239}
240
241impl Ord for UnixMountPoint {
242 #[inline]
243 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
244 self.compare(other).cmp(&0)
245 }
246}
247
248unsafe impl Send for UnixMountPoint {}
249unsafe impl Sync for UnixMountPoint {}