gio/auto/
unix_mount_point.rs1use crate::{ffi, Icon};
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug)]
10 pub struct UnixMountPoint(Boxed<ffi::GUnixMountPoint>);
11
12 match fn {
13 copy => |ptr| ffi::g_unix_mount_point_copy(mut_override(ptr)),
14 free => |ptr| ffi::g_unix_mount_point_free(ptr),
15 type_ => || ffi::g_unix_mount_point_get_type(),
16 }
17}
18
19impl UnixMountPoint {
20 #[doc(alias = "g_unix_mount_point_compare")]
21 fn compare(&self, mount2: &UnixMountPoint) -> i32 {
22 unsafe {
23 ffi::g_unix_mount_point_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_point_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_point_get_device_path(mut_override(
35 self.to_glib_none().0,
36 )))
37 }
38 }
39
40 #[doc(alias = "g_unix_mount_point_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_point_get_fs_type(mut_override(
45 self.to_glib_none().0,
46 )))
47 }
48 }
49
50 #[doc(alias = "g_unix_mount_point_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_point_get_mount_path(mut_override(
55 self.to_glib_none().0,
56 )))
57 }
58 }
59
60 #[doc(alias = "g_unix_mount_point_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_point_get_options(mut_override(
65 self.to_glib_none().0,
66 )))
67 }
68 }
69
70 #[doc(alias = "g_unix_mount_point_guess_can_eject")]
71 pub fn guess_can_eject(&self) -> bool {
72 unsafe {
73 from_glib(ffi::g_unix_mount_point_guess_can_eject(mut_override(
74 self.to_glib_none().0,
75 )))
76 }
77 }
78
79 #[doc(alias = "g_unix_mount_point_guess_icon")]
80 pub fn guess_icon(&self) -> Icon {
81 unsafe {
82 from_glib_full(ffi::g_unix_mount_point_guess_icon(mut_override(
83 self.to_glib_none().0,
84 )))
85 }
86 }
87
88 #[doc(alias = "g_unix_mount_point_guess_name")]
89 pub fn guess_name(&self) -> glib::GString {
90 unsafe {
91 from_glib_full(ffi::g_unix_mount_point_guess_name(mut_override(
92 self.to_glib_none().0,
93 )))
94 }
95 }
96
97 #[doc(alias = "g_unix_mount_point_guess_symbolic_icon")]
98 pub fn guess_symbolic_icon(&self) -> Icon {
99 unsafe {
100 from_glib_full(ffi::g_unix_mount_point_guess_symbolic_icon(mut_override(
101 self.to_glib_none().0,
102 )))
103 }
104 }
105
106 #[doc(alias = "g_unix_mount_point_is_loopback")]
107 pub fn is_loopback(&self) -> bool {
108 unsafe {
109 from_glib(ffi::g_unix_mount_point_is_loopback(mut_override(
110 self.to_glib_none().0,
111 )))
112 }
113 }
114
115 #[doc(alias = "g_unix_mount_point_is_readonly")]
116 pub fn is_readonly(&self) -> bool {
117 unsafe {
118 from_glib(ffi::g_unix_mount_point_is_readonly(mut_override(
119 self.to_glib_none().0,
120 )))
121 }
122 }
123
124 #[doc(alias = "g_unix_mount_point_is_user_mountable")]
125 pub fn is_user_mountable(&self) -> bool {
126 unsafe {
127 from_glib(ffi::g_unix_mount_point_is_user_mountable(mut_override(
128 self.to_glib_none().0,
129 )))
130 }
131 }
132
133 #[cfg(feature = "v2_66")]
134 #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
135 #[doc(alias = "g_unix_mount_point_at")]
136 pub fn at(mount_path: impl AsRef<std::path::Path>) -> (Option<UnixMountPoint>, u64) {
137 unsafe {
138 let mut time_read = std::mem::MaybeUninit::uninit();
139 let ret = from_glib_full(ffi::g_unix_mount_point_at(
140 mount_path.as_ref().to_glib_none().0,
141 time_read.as_mut_ptr(),
142 ));
143 (ret, time_read.assume_init())
144 }
145 }
146}
147
148impl PartialEq for UnixMountPoint {
149 #[inline]
150 fn eq(&self, other: &Self) -> bool {
151 self.compare(other) == 0
152 }
153}
154
155impl Eq for UnixMountPoint {}
156
157impl PartialOrd for UnixMountPoint {
158 #[inline]
159 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
160 Some(self.cmp(other))
161 }
162}
163
164impl Ord for UnixMountPoint {
165 #[inline]
166 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
167 self.compare(other).cmp(&0)
168 }
169}
170
171unsafe impl Send for UnixMountPoint {}
172unsafe impl Sync for UnixMountPoint {}