gio/auto/
unix_mount_entry.rs1use crate::{ffi, Icon};
6use glib::translate::*;
7
8glib::wrapper! {
9 #[derive(Debug)]
10 pub struct UnixMountEntry(Boxed<ffi::GUnixMountEntry>);
11
12 match fn {
13 copy => |ptr| ffi::g_unix_mount_entry_copy(mut_override(ptr)),
14 free => |ptr| ffi::g_unix_mount_entry_free(ptr),
15 type_ => || ffi::g_unix_mount_entry_get_type(),
16 }
17}
18
19impl UnixMountEntry {
20 #[doc(alias = "g_unix_mount_entry_compare")]
21 fn compare(&self, mount2: &UnixMountEntry) -> 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 #[cfg(feature = "v2_58")]
61 #[cfg_attr(docsrs, doc(cfg(feature = "v2_58")))]
62 #[doc(alias = "g_unix_mount_entry_get_options")]
63 #[doc(alias = "get_options")]
64 pub fn options(&self) -> Option<glib::GString> {
65 unsafe {
66 from_glib_none(ffi::g_unix_mount_entry_get_options(mut_override(
67 self.to_glib_none().0,
68 )))
69 }
70 }
71
72 #[cfg(feature = "v2_60")]
73 #[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
74 #[doc(alias = "g_unix_mount_entry_get_root_path")]
75 #[doc(alias = "get_root_path")]
76 pub fn root_path(&self) -> Option<glib::GString> {
77 unsafe {
78 from_glib_none(ffi::g_unix_mount_entry_get_root_path(mut_override(
79 self.to_glib_none().0,
80 )))
81 }
82 }
83
84 #[doc(alias = "g_unix_mount_entry_guess_can_eject")]
85 pub fn guess_can_eject(&self) -> bool {
86 unsafe {
87 from_glib(ffi::g_unix_mount_entry_guess_can_eject(mut_override(
88 self.to_glib_none().0,
89 )))
90 }
91 }
92
93 #[doc(alias = "g_unix_mount_entry_guess_icon")]
94 pub fn guess_icon(&self) -> Icon {
95 unsafe {
96 from_glib_full(ffi::g_unix_mount_entry_guess_icon(mut_override(
97 self.to_glib_none().0,
98 )))
99 }
100 }
101
102 #[doc(alias = "g_unix_mount_entry_guess_name")]
103 pub fn guess_name(&self) -> glib::GString {
104 unsafe {
105 from_glib_full(ffi::g_unix_mount_entry_guess_name(mut_override(
106 self.to_glib_none().0,
107 )))
108 }
109 }
110
111 #[doc(alias = "g_unix_mount_entry_guess_should_display")]
112 pub fn guess_should_display(&self) -> bool {
113 unsafe {
114 from_glib(ffi::g_unix_mount_entry_guess_should_display(mut_override(
115 self.to_glib_none().0,
116 )))
117 }
118 }
119
120 #[doc(alias = "g_unix_mount_entry_guess_symbolic_icon")]
121 pub fn guess_symbolic_icon(&self) -> Icon {
122 unsafe {
123 from_glib_full(ffi::g_unix_mount_entry_guess_symbolic_icon(mut_override(
124 self.to_glib_none().0,
125 )))
126 }
127 }
128
129 #[doc(alias = "g_unix_mount_entry_is_readonly")]
130 pub fn is_readonly(&self) -> bool {
131 unsafe {
132 from_glib(ffi::g_unix_mount_entry_is_readonly(mut_override(
133 self.to_glib_none().0,
134 )))
135 }
136 }
137
138 #[doc(alias = "g_unix_mount_entry_is_system_internal")]
139 pub fn is_system_internal(&self) -> bool {
140 unsafe {
141 from_glib(ffi::g_unix_mount_entry_is_system_internal(mut_override(
142 self.to_glib_none().0,
143 )))
144 }
145 }
146
147 #[doc(alias = "g_unix_mount_entry_at")]
148 #[doc(alias = "at")]
149 pub fn for_mount_path(
150 mount_path: impl AsRef<std::path::Path>,
151 ) -> (Option<UnixMountEntry>, u64) {
152 unsafe {
153 let mut time_read = std::mem::MaybeUninit::uninit();
154 let ret = from_glib_full(ffi::g_unix_mount_entry_at(
155 mount_path.as_ref().to_glib_none().0,
156 time_read.as_mut_ptr(),
157 ));
158 (ret, time_read.assume_init())
159 }
160 }
161
162 #[doc(alias = "g_unix_mount_entry_for")]
163 #[doc(alias = "for")]
164 pub fn for_file_path(file_path: impl AsRef<std::path::Path>) -> (Option<UnixMountEntry>, u64) {
165 unsafe {
166 let mut time_read = std::mem::MaybeUninit::uninit();
167 let ret = from_glib_full(ffi::g_unix_mount_entry_for(
168 file_path.as_ref().to_glib_none().0,
169 time_read.as_mut_ptr(),
170 ));
171 (ret, time_read.assume_init())
172 }
173 }
174}
175
176impl PartialEq for UnixMountEntry {
177 #[inline]
178 fn eq(&self, other: &Self) -> bool {
179 self.compare(other) == 0
180 }
181}
182
183impl Eq for UnixMountEntry {}
184
185impl PartialOrd for UnixMountEntry {
186 #[inline]
187 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
188 Some(self.cmp(other))
189 }
190}
191
192impl Ord for UnixMountEntry {
193 #[inline]
194 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
195 self.compare(other).cmp(&0)
196 }
197}
198
199unsafe impl Send for UnixMountEntry {}
200unsafe impl Sync for UnixMountEntry {}