1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4
5 use crate::translate::*;
6 use crate::Bytes;
7 use crate::ChecksumType;
8 use crate::Error;
9 #[cfg(any(feature = "v2_66", feature = "dox"))]
10 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
11 use crate::FileSetContentsFlags;
12 use crate::FileTest;
13 use crate::FormatSizeFlags;
14 use crate::Pid;
15 use crate::Source;
16 use crate::SpawnFlags;
17 use crate::UserDirectory;
18 use std::boxed::Box as Box_;
19 use std::mem;
20 use std::ptr;
21
22 #[doc(alias = "g_access")]
access<P: AsRef<std::path::Path>>(filename: P, mode: i32) -> i3223 pub fn access<P: AsRef<std::path::Path>>(filename: P, mode: i32) -> i32 {
24 unsafe { ffi::g_access(filename.as_ref().to_glib_none().0, mode) }
25 }
26
27 #[doc(alias = "g_assert_warning")]
assert_warning( log_domain: &str, file: &str, line: i32, pretty_function: &str, expression: &str, )28 pub fn assert_warning(
29 log_domain: &str,
30 file: &str,
31 line: i32,
32 pretty_function: &str,
33 expression: &str,
34 ) {
35 unsafe {
36 ffi::g_assert_warning(
37 log_domain.to_glib_none().0,
38 file.to_glib_none().0,
39 line,
40 pretty_function.to_glib_none().0,
41 expression.to_glib_none().0,
42 );
43 }
44 }
45
46 #[doc(alias = "g_assertion_message")]
assertion_message(domain: &str, file: &str, line: i32, func: &str, message: &str)47 pub fn assertion_message(domain: &str, file: &str, line: i32, func: &str, message: &str) {
48 unsafe {
49 ffi::g_assertion_message(
50 domain.to_glib_none().0,
51 file.to_glib_none().0,
52 line,
53 func.to_glib_none().0,
54 message.to_glib_none().0,
55 );
56 }
57 }
58
59 //#[doc(alias = "g_assertion_message_cmpnum")]
60 //pub fn assertion_message_cmpnum(domain: &str, file: &str, line: i32, func: &str, expr: &str, arg1: /*Unknown conversion*//*Unimplemented*/Unsupported, cmp: &str, arg2: /*Unknown conversion*//*Unimplemented*/Unsupported, numtype: crate::Char) {
61 // unsafe { TODO: call ffi:g_assertion_message_cmpnum() }
62 //}
63
64 #[doc(alias = "g_assertion_message_cmpstr")]
assertion_message_cmpstr( domain: &str, file: &str, line: i32, func: &str, expr: &str, arg1: &str, cmp: &str, arg2: &str, )65 pub fn assertion_message_cmpstr(
66 domain: &str,
67 file: &str,
68 line: i32,
69 func: &str,
70 expr: &str,
71 arg1: &str,
72 cmp: &str,
73 arg2: &str,
74 ) {
75 unsafe {
76 ffi::g_assertion_message_cmpstr(
77 domain.to_glib_none().0,
78 file.to_glib_none().0,
79 line,
80 func.to_glib_none().0,
81 expr.to_glib_none().0,
82 arg1.to_glib_none().0,
83 cmp.to_glib_none().0,
84 arg2.to_glib_none().0,
85 );
86 }
87 }
88
89 #[doc(alias = "g_base64_decode")]
base64_decode(text: &str) -> Vec<u8>90 pub fn base64_decode(text: &str) -> Vec<u8> {
91 unsafe {
92 let mut out_len = mem::MaybeUninit::uninit();
93 let ret = FromGlibContainer::from_glib_full_num(
94 ffi::g_base64_decode(text.to_glib_none().0, out_len.as_mut_ptr()),
95 out_len.assume_init() as usize,
96 );
97 ret
98 }
99 }
100
101 //#[doc(alias = "g_base64_decode_inplace")]
102 //pub fn base64_decode_inplace(text: /*Unimplemented*/Vec<u8>) -> u8 {
103 // unsafe { TODO: call ffi:g_base64_decode_inplace() }
104 //}
105
106 //#[doc(alias = "g_base64_decode_step")]
107 //pub fn base64_decode_step(in_: &[u8], out: Vec<u8>, state: &mut i32, save: &mut u32) -> usize {
108 // unsafe { TODO: call ffi:g_base64_decode_step() }
109 //}
110
111 #[doc(alias = "g_base64_encode")]
base64_encode(data: &[u8]) -> crate::GString112 pub fn base64_encode(data: &[u8]) -> crate::GString {
113 let len = data.len() as usize;
114 unsafe { from_glib_full(ffi::g_base64_encode(data.to_glib_none().0, len)) }
115 }
116
117 //#[doc(alias = "g_base64_encode_close")]
118 //pub fn base64_encode_close(break_lines: bool, out: Vec<u8>, state: &mut i32, save: &mut i32) -> usize {
119 // unsafe { TODO: call ffi:g_base64_encode_close() }
120 //}
121
122 //#[doc(alias = "g_base64_encode_step")]
123 //pub fn base64_encode_step(in_: &[u8], break_lines: bool, out: Vec<u8>, state: &mut i32, save: &mut i32) -> usize {
124 // unsafe { TODO: call ffi:g_base64_encode_step() }
125 //}
126
127 #[doc(alias = "g_bit_nth_lsf")]
bit_nth_lsf(mask: libc::c_ulong, nth_bit: i32) -> i32128 pub fn bit_nth_lsf(mask: libc::c_ulong, nth_bit: i32) -> i32 {
129 unsafe { ffi::g_bit_nth_lsf(mask, nth_bit) }
130 }
131
132 #[doc(alias = "g_bit_nth_msf")]
bit_nth_msf(mask: libc::c_ulong, nth_bit: i32) -> i32133 pub fn bit_nth_msf(mask: libc::c_ulong, nth_bit: i32) -> i32 {
134 unsafe { ffi::g_bit_nth_msf(mask, nth_bit) }
135 }
136
137 #[doc(alias = "g_bit_storage")]
bit_storage(number: libc::c_ulong) -> u32138 pub fn bit_storage(number: libc::c_ulong) -> u32 {
139 unsafe { ffi::g_bit_storage(number) }
140 }
141
142 //#[doc(alias = "g_build_filename")]
143 //pub fn build_filename<P: AsRef<std::path::Path>>(first_element: P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> std::path::PathBuf {
144 // unsafe { TODO: call ffi:g_build_filename() }
145 //}
146
147 //#[cfg(any(feature = "v2_56", feature = "dox"))]
148 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_56")))]
149 //#[doc(alias = "g_build_filename_valist")]
150 //pub fn build_filename_valist<P: AsRef<std::path::Path>>(first_element: P, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> std::path::PathBuf {
151 // unsafe { TODO: call ffi:g_build_filename_valist() }
152 //}
153
154 #[doc(alias = "g_build_filenamev")]
build_filenamev(args: &[&std::path::Path]) -> std::path::PathBuf155 pub fn build_filenamev(args: &[&std::path::Path]) -> std::path::PathBuf {
156 unsafe { from_glib_full(ffi::g_build_filenamev(args.to_glib_none().0)) }
157 }
158
159 //#[doc(alias = "g_build_path")]
160 //pub fn build_path<P: AsRef<std::path::Path>, Q: AsRef<std::path::Path>>(separator: P, first_element: Q, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> std::path::PathBuf {
161 // unsafe { TODO: call ffi:g_build_path() }
162 //}
163
164 #[doc(alias = "g_build_pathv")]
build_pathv(separator: &str, args: &[&std::path::Path]) -> std::path::PathBuf165 pub fn build_pathv(separator: &str, args: &[&std::path::Path]) -> std::path::PathBuf {
166 unsafe {
167 from_glib_full(ffi::g_build_pathv(
168 separator.to_glib_none().0,
169 args.to_glib_none().0,
170 ))
171 }
172 }
173
174 #[cfg(any(feature = "v2_58", feature = "dox"))]
175 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_58")))]
176 #[doc(alias = "g_canonicalize_filename")]
canonicalize_filename<P: AsRef<std::path::Path>, Q: AsRef<std::path::Path>>( filename: P, relative_to: Q, ) -> std::path::PathBuf177 pub fn canonicalize_filename<P: AsRef<std::path::Path>, Q: AsRef<std::path::Path>>(
178 filename: P,
179 relative_to: Q,
180 ) -> std::path::PathBuf {
181 unsafe {
182 from_glib_full(ffi::g_canonicalize_filename(
183 filename.as_ref().to_glib_none().0,
184 relative_to.as_ref().to_glib_none().0,
185 ))
186 }
187 }
188
189 #[doc(alias = "g_chdir")]
chdir<P: AsRef<std::path::Path>>(path: P) -> i32190 pub fn chdir<P: AsRef<std::path::Path>>(path: P) -> i32 {
191 unsafe { ffi::g_chdir(path.as_ref().to_glib_none().0) }
192 }
193
194 #[doc(alias = "glib_check_version")]
check_version( required_major: u32, required_minor: u32, required_micro: u32, ) -> crate::GString195 pub fn check_version(
196 required_major: u32,
197 required_minor: u32,
198 required_micro: u32,
199 ) -> crate::GString {
200 unsafe {
201 from_glib_none(ffi::glib_check_version(
202 required_major,
203 required_minor,
204 required_micro,
205 ))
206 }
207 }
208
209 #[doc(alias = "g_clear_error")]
clear_error() -> Result<(), crate::Error>210 pub fn clear_error() -> Result<(), crate::Error> {
211 unsafe {
212 let mut error = ptr::null_mut();
213 let _ = ffi::g_clear_error(&mut error);
214 if error.is_null() {
215 Ok(())
216 } else {
217 Err(from_glib_full(error))
218 }
219 }
220 }
221
222 //#[cfg(any(feature = "v2_56", feature = "dox"))]
223 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_56")))]
224 //#[doc(alias = "g_clear_handle_id")]
225 //pub fn clear_handle_id<P: Fn(u32) + Send + Sync + 'static>(tag_ptr: u32, clear_func: P) {
226 // unsafe { TODO: call ffi:g_clear_handle_id() }
227 //}
228
229 //#[cfg(any(feature = "v2_64", feature = "dox"))]
230 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_64")))]
231 //#[doc(alias = "g_clear_list")]
232 //pub fn clear_list(list_ptr: /*Unimplemented*/&[&Fundamental: Pointer]) {
233 // unsafe { TODO: call ffi:g_clear_list() }
234 //}
235
236 //#[doc(alias = "g_clear_pointer")]
237 //pub fn clear_pointer(pp: /*Unimplemented*/Fundamental: Pointer) {
238 // unsafe { TODO: call ffi:g_clear_pointer() }
239 //}
240
241 //#[cfg(any(feature = "v2_64", feature = "dox"))]
242 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_64")))]
243 //#[doc(alias = "g_clear_slist")]
244 //pub fn clear_slist(slist_ptr: /*Unimplemented*/&[&Fundamental: Pointer]) {
245 // unsafe { TODO: call ffi:g_clear_slist() }
246 //}
247
248 #[doc(alias = "g_compute_checksum_for_bytes")]
compute_checksum_for_bytes( checksum_type: ChecksumType, data: &Bytes, ) -> Option<crate::GString>249 pub fn compute_checksum_for_bytes(
250 checksum_type: ChecksumType,
251 data: &Bytes,
252 ) -> Option<crate::GString> {
253 unsafe {
254 from_glib_full(ffi::g_compute_checksum_for_bytes(
255 checksum_type.into_glib(),
256 data.to_glib_none().0,
257 ))
258 }
259 }
260
261 #[doc(alias = "g_compute_checksum_for_data")]
compute_checksum_for_data( checksum_type: ChecksumType, data: &[u8], ) -> Option<crate::GString>262 pub fn compute_checksum_for_data(
263 checksum_type: ChecksumType,
264 data: &[u8],
265 ) -> Option<crate::GString> {
266 let length = data.len() as usize;
267 unsafe {
268 from_glib_full(ffi::g_compute_checksum_for_data(
269 checksum_type.into_glib(),
270 data.to_glib_none().0,
271 length,
272 ))
273 }
274 }
275
276 #[doc(alias = "g_compute_checksum_for_string")]
compute_checksum_for_string( checksum_type: ChecksumType, str: &str, ) -> Option<crate::GString>277 pub fn compute_checksum_for_string(
278 checksum_type: ChecksumType,
279 str: &str,
280 ) -> Option<crate::GString> {
281 let length = str.len() as isize;
282 unsafe {
283 from_glib_full(ffi::g_compute_checksum_for_string(
284 checksum_type.into_glib(),
285 str.to_glib_none().0,
286 length,
287 ))
288 }
289 }
290
291 #[cfg(any(feature = "v2_50", feature = "dox"))]
292 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
293 #[doc(alias = "g_compute_hmac_for_bytes")]
compute_hmac_for_bytes( digest_type: ChecksumType, key: &Bytes, data: &Bytes, ) -> crate::GString294 pub fn compute_hmac_for_bytes(
295 digest_type: ChecksumType,
296 key: &Bytes,
297 data: &Bytes,
298 ) -> crate::GString {
299 unsafe {
300 from_glib_full(ffi::g_compute_hmac_for_bytes(
301 digest_type.into_glib(),
302 key.to_glib_none().0,
303 data.to_glib_none().0,
304 ))
305 }
306 }
307
308 #[doc(alias = "g_compute_hmac_for_data")]
compute_hmac_for_data(digest_type: ChecksumType, key: &[u8], data: &[u8]) -> crate::GString309 pub fn compute_hmac_for_data(digest_type: ChecksumType, key: &[u8], data: &[u8]) -> crate::GString {
310 let key_len = key.len() as usize;
311 let length = data.len() as usize;
312 unsafe {
313 from_glib_full(ffi::g_compute_hmac_for_data(
314 digest_type.into_glib(),
315 key.to_glib_none().0,
316 key_len,
317 data.to_glib_none().0,
318 length,
319 ))
320 }
321 }
322
323 #[doc(alias = "g_compute_hmac_for_string")]
compute_hmac_for_string(digest_type: ChecksumType, key: &[u8], str: &str) -> crate::GString324 pub fn compute_hmac_for_string(digest_type: ChecksumType, key: &[u8], str: &str) -> crate::GString {
325 let key_len = key.len() as usize;
326 let length = str.len() as isize;
327 unsafe {
328 from_glib_full(ffi::g_compute_hmac_for_string(
329 digest_type.into_glib(),
330 key.to_glib_none().0,
331 key_len,
332 str.to_glib_none().0,
333 length,
334 ))
335 }
336 }
337
338 //#[doc(alias = "g_convert_with_iconv")]
339 //pub fn convert_with_iconv(str: &[u8], converter: /*Ignored*/&IConv) -> Result<(Vec<u8>, usize), crate::Error> {
340 // unsafe { TODO: call ffi:g_convert_with_iconv() }
341 //}
342
343 //#[doc(alias = "g_datalist_clear")]
344 //pub fn datalist_clear(datalist: /*Ignored*/&mut Data) {
345 // unsafe { TODO: call ffi:g_datalist_clear() }
346 //}
347
348 //#[doc(alias = "g_datalist_foreach")]
349 //pub fn datalist_foreach(datalist: /*Ignored*/&mut Data, func: /*Unimplemented*/FnMut(Quark, /*Unimplemented*/Option<Fundamental: Pointer>), user_data: /*Unimplemented*/Option<Fundamental: Pointer>) {
350 // unsafe { TODO: call ffi:g_datalist_foreach() }
351 //}
352
353 //#[doc(alias = "g_datalist_get_data")]
354 //pub fn datalist_get_data(datalist: /*Ignored*/&mut Data, key: &str) -> /*Unimplemented*/Option<Fundamental: Pointer> {
355 // unsafe { TODO: call ffi:g_datalist_get_data() }
356 //}
357
358 //#[doc(alias = "g_datalist_get_flags")]
359 //pub fn datalist_get_flags(datalist: /*Ignored*/&mut Data) -> u32 {
360 // unsafe { TODO: call ffi:g_datalist_get_flags() }
361 //}
362
363 //#[doc(alias = "g_datalist_id_dup_data")]
364 //pub fn datalist_id_dup_data(datalist: /*Ignored*/&mut Data, key_id: Quark, dup_func: /*Unimplemented*/FnMut(/*Unimplemented*/Option<Fundamental: Pointer>) -> /*Unimplemented*/Option<Fundamental: Pointer>, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> /*Unimplemented*/Option<Fundamental: Pointer> {
365 // unsafe { TODO: call ffi:g_datalist_id_dup_data() }
366 //}
367
368 //#[doc(alias = "g_datalist_id_get_data")]
369 //pub fn datalist_id_get_data(datalist: /*Ignored*/&mut Data, key_id: Quark) -> /*Unimplemented*/Option<Fundamental: Pointer> {
370 // unsafe { TODO: call ffi:g_datalist_id_get_data() }
371 //}
372
373 //#[doc(alias = "g_datalist_id_remove_no_notify")]
374 //pub fn datalist_id_remove_no_notify(datalist: /*Ignored*/&mut Data, key_id: Quark) -> /*Unimplemented*/Option<Fundamental: Pointer> {
375 // unsafe { TODO: call ffi:g_datalist_id_remove_no_notify() }
376 //}
377
378 //#[doc(alias = "g_datalist_id_replace_data")]
379 //pub fn datalist_id_replace_data(datalist: /*Ignored*/&mut Data, key_id: Quark, oldval: /*Unimplemented*/Option<Fundamental: Pointer>, newval: /*Unimplemented*/Option<Fundamental: Pointer>) -> Option<Fn() + 'static> {
380 // unsafe { TODO: call ffi:g_datalist_id_replace_data() }
381 //}
382
383 //#[doc(alias = "g_datalist_id_set_data_full")]
384 //pub fn datalist_id_set_data_full(datalist: /*Ignored*/&mut Data, key_id: Quark, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
385 // unsafe { TODO: call ffi:g_datalist_id_set_data_full() }
386 //}
387
388 //#[doc(alias = "g_datalist_init")]
389 //pub fn datalist_init(datalist: /*Ignored*/&mut Data) {
390 // unsafe { TODO: call ffi:g_datalist_init() }
391 //}
392
393 //#[doc(alias = "g_datalist_set_flags")]
394 //pub fn datalist_set_flags(datalist: /*Ignored*/&mut Data, flags: u32) {
395 // unsafe { TODO: call ffi:g_datalist_set_flags() }
396 //}
397
398 //#[doc(alias = "g_datalist_unset_flags")]
399 //pub fn datalist_unset_flags(datalist: /*Ignored*/&mut Data, flags: u32) {
400 // unsafe { TODO: call ffi:g_datalist_unset_flags() }
401 //}
402
403 //#[doc(alias = "g_dataset_destroy")]
404 //pub fn dataset_destroy(dataset_location: /*Unimplemented*/Fundamental: Pointer) {
405 // unsafe { TODO: call ffi:g_dataset_destroy() }
406 //}
407
408 //#[doc(alias = "g_dataset_foreach")]
409 //pub fn dataset_foreach(dataset_location: /*Unimplemented*/Fundamental: Pointer, func: /*Unimplemented*/FnMut(Quark, /*Unimplemented*/Option<Fundamental: Pointer>), user_data: /*Unimplemented*/Option<Fundamental: Pointer>) {
410 // unsafe { TODO: call ffi:g_dataset_foreach() }
411 //}
412
413 //#[doc(alias = "g_dataset_id_get_data")]
414 //pub fn dataset_id_get_data(dataset_location: /*Unimplemented*/Fundamental: Pointer, key_id: Quark) -> /*Unimplemented*/Option<Fundamental: Pointer> {
415 // unsafe { TODO: call ffi:g_dataset_id_get_data() }
416 //}
417
418 //#[doc(alias = "g_dataset_id_remove_no_notify")]
419 //pub fn dataset_id_remove_no_notify(dataset_location: /*Unimplemented*/Fundamental: Pointer, key_id: Quark) -> /*Unimplemented*/Option<Fundamental: Pointer> {
420 // unsafe { TODO: call ffi:g_dataset_id_remove_no_notify() }
421 //}
422
423 //#[doc(alias = "g_dataset_id_set_data_full")]
424 //pub fn dataset_id_set_data_full(dataset_location: /*Unimplemented*/Fundamental: Pointer, key_id: Quark, data: /*Unimplemented*/Option<Fundamental: Pointer>) {
425 // unsafe { TODO: call ffi:g_dataset_id_set_data_full() }
426 //}
427
428 #[doc(alias = "g_dcgettext")]
dcgettext(domain: Option<&str>, msgid: &str, category: i32) -> crate::GString429 pub fn dcgettext(domain: Option<&str>, msgid: &str, category: i32) -> crate::GString {
430 unsafe {
431 from_glib_none(ffi::g_dcgettext(
432 domain.to_glib_none().0,
433 msgid.to_glib_none().0,
434 category,
435 ))
436 }
437 }
438
439 #[doc(alias = "g_dgettext")]
dgettext(domain: Option<&str>, msgid: &str) -> crate::GString440 pub fn dgettext(domain: Option<&str>, msgid: &str) -> crate::GString {
441 unsafe {
442 from_glib_none(ffi::g_dgettext(
443 domain.to_glib_none().0,
444 msgid.to_glib_none().0,
445 ))
446 }
447 }
448
449 //#[doc(alias = "g_direct_equal")]
450 //pub fn direct_equal(v1: /*Unimplemented*/Option<Fundamental: Pointer>, v2: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
451 // unsafe { TODO: call ffi:g_direct_equal() }
452 //}
453
454 //#[doc(alias = "g_direct_hash")]
455 //pub fn direct_hash(v: /*Unimplemented*/Option<Fundamental: Pointer>) -> u32 {
456 // unsafe { TODO: call ffi:g_direct_hash() }
457 //}
458
459 #[doc(alias = "g_dngettext")]
dngettext( domain: Option<&str>, msgid: &str, msgid_plural: &str, n: libc::c_ulong, ) -> crate::GString460 pub fn dngettext(
461 domain: Option<&str>,
462 msgid: &str,
463 msgid_plural: &str,
464 n: libc::c_ulong,
465 ) -> crate::GString {
466 unsafe {
467 from_glib_none(ffi::g_dngettext(
468 domain.to_glib_none().0,
469 msgid.to_glib_none().0,
470 msgid_plural.to_glib_none().0,
471 n,
472 ))
473 }
474 }
475
476 //#[doc(alias = "g_double_equal")]
477 //pub fn double_equal(v1: /*Unimplemented*/Fundamental: Pointer, v2: /*Unimplemented*/Fundamental: Pointer) -> bool {
478 // unsafe { TODO: call ffi:g_double_equal() }
479 //}
480
481 //#[doc(alias = "g_double_hash")]
482 //pub fn double_hash(v: /*Unimplemented*/Fundamental: Pointer) -> u32 {
483 // unsafe { TODO: call ffi:g_double_hash() }
484 //}
485
486 #[doc(alias = "g_dpgettext")]
dpgettext(domain: Option<&str>, msgctxtid: &str, msgidoffset: usize) -> crate::GString487 pub fn dpgettext(domain: Option<&str>, msgctxtid: &str, msgidoffset: usize) -> crate::GString {
488 unsafe {
489 from_glib_none(ffi::g_dpgettext(
490 domain.to_glib_none().0,
491 msgctxtid.to_glib_none().0,
492 msgidoffset,
493 ))
494 }
495 }
496
497 #[doc(alias = "g_dpgettext2")]
dpgettext2(domain: Option<&str>, context: &str, msgid: &str) -> crate::GString498 pub fn dpgettext2(domain: Option<&str>, context: &str, msgid: &str) -> crate::GString {
499 unsafe {
500 from_glib_none(ffi::g_dpgettext2(
501 domain.to_glib_none().0,
502 context.to_glib_none().0,
503 msgid.to_glib_none().0,
504 ))
505 }
506 }
507
508 //#[doc(alias = "g_file_error_from_errno")]
509 //pub fn file_error_from_errno(err_no: i32) -> /*Ignored*/FileError {
510 // unsafe { TODO: call ffi:g_file_error_from_errno() }
511 //}
512
513 #[doc(alias = "g_file_get_contents")]
file_get_contents<P: AsRef<std::path::Path>>(filename: P) -> Result<Vec<u8>, crate::Error>514 pub fn file_get_contents<P: AsRef<std::path::Path>>(filename: P) -> Result<Vec<u8>, crate::Error> {
515 unsafe {
516 let mut contents = ptr::null_mut();
517 let mut length = mem::MaybeUninit::uninit();
518 let mut error = ptr::null_mut();
519 let _ = ffi::g_file_get_contents(
520 filename.as_ref().to_glib_none().0,
521 &mut contents,
522 length.as_mut_ptr(),
523 &mut error,
524 );
525 if error.is_null() {
526 Ok(FromGlibContainer::from_glib_full_num(
527 contents,
528 length.assume_init() as usize,
529 ))
530 } else {
531 Err(from_glib_full(error))
532 }
533 }
534 }
535
536 #[doc(alias = "g_file_open_tmp")]
file_open_tmp<P: AsRef<std::path::Path>>( tmpl: P, ) -> Result<(i32, std::path::PathBuf), crate::Error>537 pub fn file_open_tmp<P: AsRef<std::path::Path>>(
538 tmpl: P,
539 ) -> Result<(i32, std::path::PathBuf), crate::Error> {
540 unsafe {
541 let mut name_used = ptr::null_mut();
542 let mut error = ptr::null_mut();
543 let ret = ffi::g_file_open_tmp(tmpl.as_ref().to_glib_none().0, &mut name_used, &mut error);
544 if error.is_null() {
545 Ok((ret, from_glib_full(name_used)))
546 } else {
547 Err(from_glib_full(error))
548 }
549 }
550 }
551
552 #[doc(alias = "g_file_read_link")]
file_read_link<P: AsRef<std::path::Path>>( filename: P, ) -> Result<std::path::PathBuf, crate::Error>553 pub fn file_read_link<P: AsRef<std::path::Path>>(
554 filename: P,
555 ) -> Result<std::path::PathBuf, crate::Error> {
556 unsafe {
557 let mut error = ptr::null_mut();
558 let ret = ffi::g_file_read_link(filename.as_ref().to_glib_none().0, &mut error);
559 if error.is_null() {
560 Ok(from_glib_full(ret))
561 } else {
562 Err(from_glib_full(error))
563 }
564 }
565 }
566
567 #[doc(alias = "g_file_set_contents")]
file_set_contents<P: AsRef<std::path::Path>>( filename: P, contents: &[u8], ) -> Result<(), crate::Error>568 pub fn file_set_contents<P: AsRef<std::path::Path>>(
569 filename: P,
570 contents: &[u8],
571 ) -> Result<(), crate::Error> {
572 let length = contents.len() as isize;
573 unsafe {
574 let mut error = ptr::null_mut();
575 let _ = ffi::g_file_set_contents(
576 filename.as_ref().to_glib_none().0,
577 contents.to_glib_none().0,
578 length,
579 &mut error,
580 );
581 if error.is_null() {
582 Ok(())
583 } else {
584 Err(from_glib_full(error))
585 }
586 }
587 }
588
589 #[cfg(any(feature = "v2_66", feature = "dox"))]
590 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
591 #[doc(alias = "g_file_set_contents_full")]
file_set_contents_full<P: AsRef<std::path::Path>>( filename: P, contents: &[u8], flags: FileSetContentsFlags, mode: i32, ) -> Result<(), crate::Error>592 pub fn file_set_contents_full<P: AsRef<std::path::Path>>(
593 filename: P,
594 contents: &[u8],
595 flags: FileSetContentsFlags,
596 mode: i32,
597 ) -> Result<(), crate::Error> {
598 let length = contents.len() as isize;
599 unsafe {
600 let mut error = ptr::null_mut();
601 let _ = ffi::g_file_set_contents_full(
602 filename.as_ref().to_glib_none().0,
603 contents.to_glib_none().0,
604 length,
605 flags.into_glib(),
606 mode,
607 &mut error,
608 );
609 if error.is_null() {
610 Ok(())
611 } else {
612 Err(from_glib_full(error))
613 }
614 }
615 }
616
617 #[doc(alias = "g_file_test")]
file_test<P: AsRef<std::path::Path>>(filename: P, test: FileTest) -> bool618 pub fn file_test<P: AsRef<std::path::Path>>(filename: P, test: FileTest) -> bool {
619 unsafe {
620 from_glib(ffi::g_file_test(
621 filename.as_ref().to_glib_none().0,
622 test.into_glib(),
623 ))
624 }
625 }
626
627 #[doc(alias = "g_filename_display_basename")]
filename_display_basename<P: AsRef<std::path::Path>>(filename: P) -> crate::GString628 pub fn filename_display_basename<P: AsRef<std::path::Path>>(filename: P) -> crate::GString {
629 unsafe {
630 from_glib_full(ffi::g_filename_display_basename(
631 filename.as_ref().to_glib_none().0,
632 ))
633 }
634 }
635
636 #[doc(alias = "g_filename_display_name")]
filename_display_name<P: AsRef<std::path::Path>>(filename: P) -> crate::GString637 pub fn filename_display_name<P: AsRef<std::path::Path>>(filename: P) -> crate::GString {
638 unsafe {
639 from_glib_full(ffi::g_filename_display_name(
640 filename.as_ref().to_glib_none().0,
641 ))
642 }
643 }
644
645 #[doc(alias = "g_format_size")]
format_size(size: u64) -> crate::GString646 pub fn format_size(size: u64) -> crate::GString {
647 unsafe { from_glib_full(ffi::g_format_size(size)) }
648 }
649
650 #[doc(alias = "g_format_size_full")]
format_size_full(size: u64, flags: FormatSizeFlags) -> crate::GString651 pub fn format_size_full(size: u64, flags: FormatSizeFlags) -> crate::GString {
652 unsafe { from_glib_full(ffi::g_format_size_full(size, flags.into_glib())) }
653 }
654
655 //#[doc(alias = "g_fprintf")]
656 //pub fn fprintf(file: /*Unimplemented*/Fundamental: Pointer, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> i32 {
657 // unsafe { TODO: call ffi:g_fprintf() }
658 //}
659
660 //#[doc(alias = "g_free")]
661 //pub fn free(mem: /*Unimplemented*/Option<Fundamental: Pointer>) {
662 // unsafe { TODO: call ffi:g_free() }
663 //}
664
665 #[doc(alias = "g_get_application_name")]
666 #[doc(alias = "get_application_name")]
application_name() -> Option<crate::GString>667 pub fn application_name() -> Option<crate::GString> {
668 unsafe { from_glib_none(ffi::g_get_application_name()) }
669 }
670
671 #[doc(alias = "g_get_codeset")]
672 #[doc(alias = "get_codeset")]
codeset() -> crate::GString673 pub fn codeset() -> crate::GString {
674 unsafe { from_glib_full(ffi::g_get_codeset()) }
675 }
676
677 #[cfg(any(feature = "v2_62", feature = "dox"))]
678 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_62")))]
679 #[doc(alias = "g_get_console_charset")]
680 #[doc(alias = "get_console_charset")]
console_charset() -> Option<crate::GString>681 pub fn console_charset() -> Option<crate::GString> {
682 unsafe {
683 let mut charset = ptr::null();
684 let ret = from_glib(ffi::g_get_console_charset(&mut charset));
685 if ret {
686 Some(from_glib_none(charset))
687 } else {
688 None
689 }
690 }
691 }
692
693 //#[cfg_attr(feature = "v2_62", deprecated = "Since 2.62")]
694 //#[doc(alias = "g_get_current_time")]
695 //#[doc(alias = "get_current_time")]
696 //pub fn current_time(result: /*Ignored*/&mut TimeVal) {
697 // unsafe { TODO: call ffi:g_get_current_time() }
698 //}
699
700 #[doc(alias = "g_get_environ")]
701 #[doc(alias = "get_environ")]
environ() -> Vec<std::ffi::OsString>702 pub fn environ() -> Vec<std::ffi::OsString> {
703 unsafe { FromGlibPtrContainer::from_glib_full(ffi::g_get_environ()) }
704 }
705
706 #[doc(alias = "g_get_host_name")]
707 #[doc(alias = "get_host_name")]
host_name() -> crate::GString708 pub fn host_name() -> crate::GString {
709 unsafe { from_glib_none(ffi::g_get_host_name()) }
710 }
711
712 #[doc(alias = "g_get_language_names")]
713 #[doc(alias = "get_language_names")]
language_names() -> Vec<crate::GString>714 pub fn language_names() -> Vec<crate::GString> {
715 unsafe { FromGlibPtrContainer::from_glib_none(ffi::g_get_language_names()) }
716 }
717
718 #[cfg(any(feature = "v2_58", feature = "dox"))]
719 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_58")))]
720 #[doc(alias = "g_get_language_names_with_category")]
721 #[doc(alias = "get_language_names_with_category")]
language_names_with_category(category_name: &str) -> Vec<crate::GString>722 pub fn language_names_with_category(category_name: &str) -> Vec<crate::GString> {
723 unsafe {
724 FromGlibPtrContainer::from_glib_none(ffi::g_get_language_names_with_category(
725 category_name.to_glib_none().0,
726 ))
727 }
728 }
729
730 #[doc(alias = "g_get_locale_variants")]
731 #[doc(alias = "get_locale_variants")]
locale_variants(locale: &str) -> Vec<crate::GString>732 pub fn locale_variants(locale: &str) -> Vec<crate::GString> {
733 unsafe {
734 FromGlibPtrContainer::from_glib_full(ffi::g_get_locale_variants(locale.to_glib_none().0))
735 }
736 }
737
738 #[doc(alias = "g_get_monotonic_time")]
739 #[doc(alias = "get_monotonic_time")]
monotonic_time() -> i64740 pub fn monotonic_time() -> i64 {
741 unsafe { ffi::g_get_monotonic_time() }
742 }
743
744 #[doc(alias = "g_get_num_processors")]
745 #[doc(alias = "get_num_processors")]
num_processors() -> u32746 pub fn num_processors() -> u32 {
747 unsafe { ffi::g_get_num_processors() }
748 }
749
750 #[cfg(any(feature = "v2_64", feature = "dox"))]
751 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_64")))]
752 #[doc(alias = "g_get_os_info")]
753 #[doc(alias = "get_os_info")]
os_info(key_name: &str) -> Option<crate::GString>754 pub fn os_info(key_name: &str) -> Option<crate::GString> {
755 unsafe { from_glib_full(ffi::g_get_os_info(key_name.to_glib_none().0)) }
756 }
757
758 #[doc(alias = "g_get_real_time")]
759 #[doc(alias = "get_real_time")]
real_time() -> i64760 pub fn real_time() -> i64 {
761 unsafe { ffi::g_get_real_time() }
762 }
763
764 #[doc(alias = "g_get_system_config_dirs")]
765 #[doc(alias = "get_system_config_dirs")]
system_config_dirs() -> Vec<std::path::PathBuf>766 pub fn system_config_dirs() -> Vec<std::path::PathBuf> {
767 unsafe { FromGlibPtrContainer::from_glib_none(ffi::g_get_system_config_dirs()) }
768 }
769
770 #[doc(alias = "g_get_system_data_dirs")]
771 #[doc(alias = "get_system_data_dirs")]
system_data_dirs() -> Vec<std::path::PathBuf>772 pub fn system_data_dirs() -> Vec<std::path::PathBuf> {
773 unsafe { FromGlibPtrContainer::from_glib_none(ffi::g_get_system_data_dirs()) }
774 }
775
776 #[doc(alias = "g_get_user_cache_dir")]
777 #[doc(alias = "get_user_cache_dir")]
user_cache_dir() -> std::path::PathBuf778 pub fn user_cache_dir() -> std::path::PathBuf {
779 unsafe { from_glib_none(ffi::g_get_user_cache_dir()) }
780 }
781
782 #[doc(alias = "g_get_user_config_dir")]
783 #[doc(alias = "get_user_config_dir")]
user_config_dir() -> std::path::PathBuf784 pub fn user_config_dir() -> std::path::PathBuf {
785 unsafe { from_glib_none(ffi::g_get_user_config_dir()) }
786 }
787
788 #[doc(alias = "g_get_user_data_dir")]
789 #[doc(alias = "get_user_data_dir")]
user_data_dir() -> std::path::PathBuf790 pub fn user_data_dir() -> std::path::PathBuf {
791 unsafe { from_glib_none(ffi::g_get_user_data_dir()) }
792 }
793
794 #[doc(alias = "g_get_user_runtime_dir")]
795 #[doc(alias = "get_user_runtime_dir")]
user_runtime_dir() -> std::path::PathBuf796 pub fn user_runtime_dir() -> std::path::PathBuf {
797 unsafe { from_glib_none(ffi::g_get_user_runtime_dir()) }
798 }
799
800 #[doc(alias = "g_get_user_special_dir")]
801 #[doc(alias = "get_user_special_dir")]
user_special_dir(directory: UserDirectory) -> std::path::PathBuf802 pub fn user_special_dir(directory: UserDirectory) -> std::path::PathBuf {
803 unsafe { from_glib_none(ffi::g_get_user_special_dir(directory.into_glib())) }
804 }
805
806 #[doc(alias = "g_hostname_is_ascii_encoded")]
hostname_is_ascii_encoded(hostname: &str) -> bool807 pub fn hostname_is_ascii_encoded(hostname: &str) -> bool {
808 unsafe { from_glib(ffi::g_hostname_is_ascii_encoded(hostname.to_glib_none().0)) }
809 }
810
811 #[doc(alias = "g_hostname_is_ip_address")]
hostname_is_ip_address(hostname: &str) -> bool812 pub fn hostname_is_ip_address(hostname: &str) -> bool {
813 unsafe { from_glib(ffi::g_hostname_is_ip_address(hostname.to_glib_none().0)) }
814 }
815
816 #[doc(alias = "g_hostname_is_non_ascii")]
hostname_is_non_ascii(hostname: &str) -> bool817 pub fn hostname_is_non_ascii(hostname: &str) -> bool {
818 unsafe { from_glib(ffi::g_hostname_is_non_ascii(hostname.to_glib_none().0)) }
819 }
820
821 #[doc(alias = "g_hostname_to_ascii")]
hostname_to_ascii(hostname: &str) -> Option<crate::GString>822 pub fn hostname_to_ascii(hostname: &str) -> Option<crate::GString> {
823 unsafe { from_glib_full(ffi::g_hostname_to_ascii(hostname.to_glib_none().0)) }
824 }
825
826 #[doc(alias = "g_hostname_to_unicode")]
hostname_to_unicode(hostname: &str) -> Option<crate::GString>827 pub fn hostname_to_unicode(hostname: &str) -> Option<crate::GString> {
828 unsafe { from_glib_full(ffi::g_hostname_to_unicode(hostname.to_glib_none().0)) }
829 }
830
831 //#[doc(alias = "g_iconv")]
832 //pub fn iconv(converter: /*Ignored*/&IConv, inbuf: &str, inbytes_left: usize, outbuf: &str, outbytes_left: usize) -> usize {
833 // unsafe { TODO: call ffi:g_iconv() }
834 //}
835
836 //#[doc(alias = "g_idle_remove_by_data")]
837 //pub fn idle_remove_by_data(data: /*Unimplemented*/Option<Fundamental: Pointer>) -> bool {
838 // unsafe { TODO: call ffi:g_idle_remove_by_data() }
839 //}
840
841 //#[doc(alias = "g_int64_equal")]
842 //pub fn int64_equal(v1: /*Unimplemented*/Fundamental: Pointer, v2: /*Unimplemented*/Fundamental: Pointer) -> bool {
843 // unsafe { TODO: call ffi:g_int64_equal() }
844 //}
845
846 //#[doc(alias = "g_int64_hash")]
847 //pub fn int64_hash(v: /*Unimplemented*/Fundamental: Pointer) -> u32 {
848 // unsafe { TODO: call ffi:g_int64_hash() }
849 //}
850
851 //#[doc(alias = "g_int_equal")]
852 //pub fn int_equal(v1: /*Unimplemented*/Fundamental: Pointer, v2: /*Unimplemented*/Fundamental: Pointer) -> bool {
853 // unsafe { TODO: call ffi:g_int_equal() }
854 //}
855
856 //#[doc(alias = "g_int_hash")]
857 //pub fn int_hash(v: /*Unimplemented*/Fundamental: Pointer) -> u32 {
858 // unsafe { TODO: call ffi:g_int_hash() }
859 //}
860
861 //#[doc(alias = "g_io_add_watch")]
862 //pub fn io_add_watch(channel: /*Ignored*/&IOChannel, condition: IOCondition, func: /*Unimplemented*/Fn(/*Ignored*/IOChannel, &IOCondition, /*Unimplemented*/Option<Fundamental: Pointer>) -> bool, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> u32 {
863 // unsafe { TODO: call ffi:g_io_add_watch() }
864 //}
865
866 //#[doc(alias = "g_io_add_watch_full")]
867 //pub fn io_add_watch_full(channel: /*Ignored*/&IOChannel, priority: i32, condition: IOCondition, func: /*Unimplemented*/Fn(/*Ignored*/IOChannel, &IOCondition, /*Unimplemented*/Option<Fundamental: Pointer>) -> bool, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> u32 {
868 // unsafe { TODO: call ffi:g_io_add_watch_full() }
869 //}
870
871 //#[doc(alias = "g_io_create_watch")]
872 //pub fn io_create_watch(channel: /*Ignored*/&IOChannel, condition: IOCondition) -> Source {
873 // unsafe { TODO: call ffi:g_io_create_watch() }
874 //}
875
876 #[doc(alias = "g_listenv")]
listenv() -> Vec<std::ffi::OsString>877 pub fn listenv() -> Vec<std::ffi::OsString> {
878 unsafe { FromGlibPtrContainer::from_glib_full(ffi::g_listenv()) }
879 }
880
881 //#[cfg(any(feature = "v2_50", feature = "dox"))]
882 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
883 //#[doc(alias = "g_log_structured_array")]
884 //pub fn log_structured_array(log_level: LogLevelFlags, fields: /*Ignored*/&[&LogField]) {
885 // unsafe { TODO: call ffi:g_log_structured_array() }
886 //}
887
888 //#[doc(alias = "g_log_structured_standard")]
889 //pub fn log_structured_standard(log_domain: &str, log_level: LogLevelFlags, file: &str, line: &str, func: &str, message_format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
890 // unsafe { TODO: call ffi:g_log_structured_standard() }
891 //}
892
893 //#[cfg(any(feature = "v2_50", feature = "dox"))]
894 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
895 //#[doc(alias = "g_log_writer_default")]
896 //pub fn log_writer_default(log_level: LogLevelFlags, fields: /*Ignored*/&[&LogField], user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> /*Ignored*/LogWriterOutput {
897 // unsafe { TODO: call ffi:g_log_writer_default() }
898 //}
899
900 //#[cfg(any(feature = "v2_50", feature = "dox"))]
901 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
902 //#[doc(alias = "g_log_writer_format_fields")]
903 //pub fn log_writer_format_fields(log_level: LogLevelFlags, fields: /*Ignored*/&[&LogField], use_color: bool) -> crate::GString {
904 // unsafe { TODO: call ffi:g_log_writer_format_fields() }
905 //}
906
907 //#[cfg(any(feature = "v2_50", feature = "dox"))]
908 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
909 //#[doc(alias = "g_log_writer_journald")]
910 //pub fn log_writer_journald(log_level: LogLevelFlags, fields: /*Ignored*/&[&LogField], user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> /*Ignored*/LogWriterOutput {
911 // unsafe { TODO: call ffi:g_log_writer_journald() }
912 //}
913
914 //#[cfg(any(feature = "v2_50", feature = "dox"))]
915 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
916 //#[doc(alias = "g_log_writer_standard_streams")]
917 //pub fn log_writer_standard_streams(log_level: LogLevelFlags, fields: /*Ignored*/&[&LogField], user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> /*Ignored*/LogWriterOutput {
918 // unsafe { TODO: call ffi:g_log_writer_standard_streams() }
919 //}
920
921 //#[doc(alias = "g_logv")]
922 //pub fn logv(log_domain: Option<&str>, log_level: LogLevelFlags, format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
923 // unsafe { TODO: call ffi:g_logv() }
924 //}
925
926 #[doc(alias = "g_main_current_source")]
main_current_source() -> Option<Source>927 pub fn main_current_source() -> Option<Source> {
928 unsafe { from_glib_none(ffi::g_main_current_source()) }
929 }
930
931 #[doc(alias = "g_main_depth")]
main_depth() -> i32932 pub fn main_depth() -> i32 {
933 unsafe { ffi::g_main_depth() }
934 }
935
936 //#[doc(alias = "g_malloc")]
937 //pub fn malloc(n_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
938 // unsafe { TODO: call ffi:g_malloc() }
939 //}
940
941 //#[doc(alias = "g_malloc0")]
942 //pub fn malloc0(n_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
943 // unsafe { TODO: call ffi:g_malloc0() }
944 //}
945
946 //#[doc(alias = "g_malloc0_n")]
947 //pub fn malloc0_n(n_blocks: usize, n_block_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
948 // unsafe { TODO: call ffi:g_malloc0_n() }
949 //}
950
951 //#[doc(alias = "g_malloc_n")]
952 //pub fn malloc_n(n_blocks: usize, n_block_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
953 // unsafe { TODO: call ffi:g_malloc_n() }
954 //}
955
956 //#[doc(alias = "g_markup_collect_attributes")]
957 //pub fn markup_collect_attributes(element_name: &str, attribute_names: &str, attribute_values: &str, error: &mut Error, first_type: /*Ignored*/MarkupCollectType, first_attr: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
958 // unsafe { TODO: call ffi:g_markup_collect_attributes() }
959 //}
960
961 #[doc(alias = "g_markup_escape_text")]
markup_escape_text(text: &str) -> crate::GString962 pub fn markup_escape_text(text: &str) -> crate::GString {
963 let length = text.len() as isize;
964 unsafe { from_glib_full(ffi::g_markup_escape_text(text.to_glib_none().0, length)) }
965 }
966
967 //#[doc(alias = "g_markup_printf_escaped")]
968 //pub fn markup_printf_escaped(format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> crate::GString {
969 // unsafe { TODO: call ffi:g_markup_printf_escaped() }
970 //}
971
972 //#[doc(alias = "g_markup_vprintf_escaped")]
973 //pub fn markup_vprintf_escaped(format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> crate::GString {
974 // unsafe { TODO: call ffi:g_markup_vprintf_escaped() }
975 //}
976
977 //#[cfg_attr(feature = "v2_68", deprecated = "Since 2.68")]
978 //#[doc(alias = "g_memdup")]
979 //pub fn memdup(mem: /*Unimplemented*/Option<Fundamental: Pointer>, byte_size: u32) -> /*Unimplemented*/Option<Fundamental: Pointer> {
980 // unsafe { TODO: call ffi:g_memdup() }
981 //}
982
983 #[doc(alias = "g_mkdir_with_parents")]
mkdir_with_parents<P: AsRef<std::path::Path>>(pathname: P, mode: i32) -> i32984 pub fn mkdir_with_parents<P: AsRef<std::path::Path>>(pathname: P, mode: i32) -> i32 {
985 unsafe { ffi::g_mkdir_with_parents(pathname.as_ref().to_glib_none().0, mode) }
986 }
987
988 #[doc(alias = "g_mkdtemp")]
mkdtemp<P: AsRef<std::path::Path>>(tmpl: P) -> Option<std::path::PathBuf>989 pub fn mkdtemp<P: AsRef<std::path::Path>>(tmpl: P) -> Option<std::path::PathBuf> {
990 unsafe { from_glib_full(ffi::g_mkdtemp(tmpl.as_ref().to_glib_none().0)) }
991 }
992
993 #[doc(alias = "g_mkdtemp_full")]
mkdtemp_full<P: AsRef<std::path::Path>>(tmpl: P, mode: i32) -> Option<std::path::PathBuf>994 pub fn mkdtemp_full<P: AsRef<std::path::Path>>(tmpl: P, mode: i32) -> Option<std::path::PathBuf> {
995 unsafe { from_glib_full(ffi::g_mkdtemp_full(tmpl.as_ref().to_glib_none().0, mode)) }
996 }
997
998 #[doc(alias = "g_mkstemp_full")]
mkstemp_full<P: AsRef<std::path::Path>>(tmpl: P, flags: i32, mode: i32) -> i32999 pub fn mkstemp_full<P: AsRef<std::path::Path>>(tmpl: P, flags: i32, mode: i32) -> i32 {
1000 unsafe { ffi::g_mkstemp_full(tmpl.as_ref().to_glib_none().0, flags, mode) }
1001 }
1002
1003 //#[doc(alias = "g_nullify_pointer")]
1004 //pub fn nullify_pointer(nullify_location: /*Unimplemented*/Fundamental: Pointer) {
1005 // unsafe { TODO: call ffi:g_nullify_pointer() }
1006 //}
1007
1008 #[doc(alias = "g_on_error_query")]
on_error_query(prg_name: &str)1009 pub fn on_error_query(prg_name: &str) {
1010 unsafe {
1011 ffi::g_on_error_query(prg_name.to_glib_none().0);
1012 }
1013 }
1014
1015 #[doc(alias = "g_on_error_stack_trace")]
on_error_stack_trace(prg_name: &str)1016 pub fn on_error_stack_trace(prg_name: &str) {
1017 unsafe {
1018 ffi::g_on_error_stack_trace(prg_name.to_glib_none().0);
1019 }
1020 }
1021
1022 //#[doc(alias = "g_parse_debug_string")]
1023 //pub fn parse_debug_string(string: Option<&str>, keys: /*Ignored*/&[&DebugKey]) -> u32 {
1024 // unsafe { TODO: call ffi:g_parse_debug_string() }
1025 //}
1026
1027 #[doc(alias = "g_path_get_basename")]
path_get_basename<P: AsRef<std::path::Path>>(file_name: P) -> std::path::PathBuf1028 pub fn path_get_basename<P: AsRef<std::path::Path>>(file_name: P) -> std::path::PathBuf {
1029 unsafe {
1030 from_glib_full(ffi::g_path_get_basename(
1031 file_name.as_ref().to_glib_none().0,
1032 ))
1033 }
1034 }
1035
1036 #[doc(alias = "g_path_get_dirname")]
path_get_dirname<P: AsRef<std::path::Path>>(file_name: P) -> std::path::PathBuf1037 pub fn path_get_dirname<P: AsRef<std::path::Path>>(file_name: P) -> std::path::PathBuf {
1038 unsafe { from_glib_full(ffi::g_path_get_dirname(file_name.as_ref().to_glib_none().0)) }
1039 }
1040
1041 #[doc(alias = "g_path_is_absolute")]
path_is_absolute<P: AsRef<std::path::Path>>(file_name: P) -> bool1042 pub fn path_is_absolute<P: AsRef<std::path::Path>>(file_name: P) -> bool {
1043 unsafe { from_glib(ffi::g_path_is_absolute(file_name.as_ref().to_glib_none().0)) }
1044 }
1045
1046 #[doc(alias = "g_path_skip_root")]
path_skip_root<P: AsRef<std::path::Path>>(file_name: P) -> Option<std::path::PathBuf>1047 pub fn path_skip_root<P: AsRef<std::path::Path>>(file_name: P) -> Option<std::path::PathBuf> {
1048 unsafe { from_glib_none(ffi::g_path_skip_root(file_name.as_ref().to_glib_none().0)) }
1049 }
1050
1051 //#[doc(alias = "g_pattern_match")]
1052 //pub fn pattern_match(pspec: /*Ignored*/&mut PatternSpec, string_length: u32, string: &str, string_reversed: Option<&str>) -> bool {
1053 // unsafe { TODO: call ffi:g_pattern_match() }
1054 //}
1055
1056 #[doc(alias = "g_pattern_match_simple")]
pattern_match_simple(pattern: &str, string: &str) -> bool1057 pub fn pattern_match_simple(pattern: &str, string: &str) -> bool {
1058 unsafe {
1059 from_glib(ffi::g_pattern_match_simple(
1060 pattern.to_glib_none().0,
1061 string.to_glib_none().0,
1062 ))
1063 }
1064 }
1065
1066 //#[doc(alias = "g_pattern_match_string")]
1067 //pub fn pattern_match_string(pspec: /*Ignored*/&mut PatternSpec, string: &str) -> bool {
1068 // unsafe { TODO: call ffi:g_pattern_match_string() }
1069 //}
1070
1071 //#[doc(alias = "g_pointer_bit_lock")]
1072 //pub fn pointer_bit_lock(address: /*Unimplemented*/Fundamental: Pointer, lock_bit: i32) {
1073 // unsafe { TODO: call ffi:g_pointer_bit_lock() }
1074 //}
1075
1076 //#[doc(alias = "g_pointer_bit_trylock")]
1077 //pub fn pointer_bit_trylock(address: /*Unimplemented*/Fundamental: Pointer, lock_bit: i32) -> bool {
1078 // unsafe { TODO: call ffi:g_pointer_bit_trylock() }
1079 //}
1080
1081 //#[doc(alias = "g_pointer_bit_unlock")]
1082 //pub fn pointer_bit_unlock(address: /*Unimplemented*/Fundamental: Pointer, lock_bit: i32) {
1083 // unsafe { TODO: call ffi:g_pointer_bit_unlock() }
1084 //}
1085
1086 //#[doc(alias = "g_poll")]
1087 //pub fn poll(fds: /*Ignored*/&mut PollFD, nfds: u32, timeout: i32) -> i32 {
1088 // unsafe { TODO: call ffi:g_poll() }
1089 //}
1090
1091 //#[doc(alias = "g_prefix_error")]
1092 //pub fn prefix_error(err: /*Unimplemented*/Option<Error>, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
1093 // unsafe { TODO: call ffi:g_prefix_error() }
1094 //}
1095
1096 //#[doc(alias = "g_print")]
1097 //pub fn print(format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
1098 // unsafe { TODO: call ffi:g_print() }
1099 //}
1100
1101 //#[doc(alias = "g_printerr")]
1102 //pub fn printerr(format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
1103 // unsafe { TODO: call ffi:g_printerr() }
1104 //}
1105
1106 //#[doc(alias = "g_printf")]
1107 //pub fn printf(format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> i32 {
1108 // unsafe { TODO: call ffi:g_printf() }
1109 //}
1110
1111 //#[doc(alias = "g_printf_string_upper_bound")]
1112 //pub fn printf_string_upper_bound(format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> usize {
1113 // unsafe { TODO: call ffi:g_printf_string_upper_bound() }
1114 //}
1115
1116 //#[doc(alias = "g_propagate_prefixed_error")]
1117 //pub fn propagate_prefixed_error(dest: &mut Error, src: &mut Error, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
1118 // unsafe { TODO: call ffi:g_propagate_prefixed_error() }
1119 //}
1120
1121 //#[doc(alias = "g_qsort_with_data")]
1122 //pub fn qsort_with_data(pbase: /*Unimplemented*/Fundamental: Pointer, total_elems: i32, size: usize, compare_func: /*Unimplemented*/Fn(/*Unimplemented*/Option<Fundamental: Pointer>, /*Unimplemented*/Option<Fundamental: Pointer>) -> i32, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) {
1123 // unsafe { TODO: call ffi:g_qsort_with_data() }
1124 //}
1125
1126 #[doc(alias = "g_random_double")]
random_double() -> f641127 pub fn random_double() -> f64 {
1128 unsafe { ffi::g_random_double() }
1129 }
1130
1131 #[doc(alias = "g_random_double_range")]
random_double_range(begin: f64, end: f64) -> f641132 pub fn random_double_range(begin: f64, end: f64) -> f64 {
1133 unsafe { ffi::g_random_double_range(begin, end) }
1134 }
1135
1136 #[doc(alias = "g_random_int")]
random_int() -> u321137 pub fn random_int() -> u32 {
1138 unsafe { ffi::g_random_int() }
1139 }
1140
1141 #[doc(alias = "g_random_int_range")]
random_int_range(begin: i32, end: i32) -> i321142 pub fn random_int_range(begin: i32, end: i32) -> i32 {
1143 unsafe { ffi::g_random_int_range(begin, end) }
1144 }
1145
1146 #[doc(alias = "g_random_set_seed")]
random_set_seed(seed: u32)1147 pub fn random_set_seed(seed: u32) {
1148 unsafe {
1149 ffi::g_random_set_seed(seed);
1150 }
1151 }
1152
1153 //#[doc(alias = "g_realloc")]
1154 //pub fn realloc(mem: /*Unimplemented*/Option<Fundamental: Pointer>, n_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1155 // unsafe { TODO: call ffi:g_realloc() }
1156 //}
1157
1158 //#[doc(alias = "g_realloc_n")]
1159 //pub fn realloc_n(mem: /*Unimplemented*/Option<Fundamental: Pointer>, n_blocks: usize, n_block_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1160 // unsafe { TODO: call ffi:g_realloc_n() }
1161 //}
1162
1163 #[doc(alias = "g_reload_user_special_dirs_cache")]
reload_user_special_dirs_cache()1164 pub fn reload_user_special_dirs_cache() {
1165 unsafe {
1166 ffi::g_reload_user_special_dirs_cache();
1167 }
1168 }
1169
1170 #[doc(alias = "g_return_if_fail_warning")]
return_if_fail_warning( log_domain: Option<&str>, pretty_function: &str, expression: Option<&str>, )1171 pub fn return_if_fail_warning(
1172 log_domain: Option<&str>,
1173 pretty_function: &str,
1174 expression: Option<&str>,
1175 ) {
1176 unsafe {
1177 ffi::g_return_if_fail_warning(
1178 log_domain.to_glib_none().0,
1179 pretty_function.to_glib_none().0,
1180 expression.to_glib_none().0,
1181 );
1182 }
1183 }
1184
1185 #[doc(alias = "g_rmdir")]
rmdir<P: AsRef<std::path::Path>>(filename: P) -> i321186 pub fn rmdir<P: AsRef<std::path::Path>>(filename: P) -> i32 {
1187 unsafe { ffi::g_rmdir(filename.as_ref().to_glib_none().0) }
1188 }
1189
1190 #[doc(alias = "g_set_application_name")]
set_application_name(application_name: &str)1191 pub fn set_application_name(application_name: &str) {
1192 unsafe {
1193 ffi::g_set_application_name(application_name.to_glib_none().0);
1194 }
1195 }
1196
1197 //#[doc(alias = "g_set_error")]
1198 //pub fn set_error(domain: Quark, code: i32, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Error {
1199 // unsafe { TODO: call ffi:g_set_error() }
1200 //}
1201
1202 //#[doc(alias = "g_set_print_handler")]
1203 //pub fn set_print_handler<P: Fn(&str) + Send + Sync + 'static>(func: P) -> Fn(&str) + 'static {
1204 // unsafe { TODO: call ffi:g_set_print_handler() }
1205 //}
1206
1207 //#[doc(alias = "g_set_printerr_handler")]
1208 //pub fn set_printerr_handler<P: Fn(&str) + Send + Sync + 'static>(func: P) -> Fn(&str) + 'static {
1209 // unsafe { TODO: call ffi:g_set_printerr_handler() }
1210 //}
1211
1212 #[doc(alias = "g_shell_parse_argv")]
shell_parse_argv<P: AsRef<std::ffi::OsStr>>( command_line: P, ) -> Result<Vec<std::ffi::OsString>, crate::Error>1213 pub fn shell_parse_argv<P: AsRef<std::ffi::OsStr>>(
1214 command_line: P,
1215 ) -> Result<Vec<std::ffi::OsString>, crate::Error> {
1216 unsafe {
1217 let mut argcp = mem::MaybeUninit::uninit();
1218 let mut argvp = ptr::null_mut();
1219 let mut error = ptr::null_mut();
1220 let _ = ffi::g_shell_parse_argv(
1221 command_line.as_ref().to_glib_none().0,
1222 argcp.as_mut_ptr(),
1223 &mut argvp,
1224 &mut error,
1225 );
1226 if error.is_null() {
1227 Ok(FromGlibContainer::from_glib_full_num(
1228 argvp,
1229 argcp.assume_init() as usize,
1230 ))
1231 } else {
1232 Err(from_glib_full(error))
1233 }
1234 }
1235 }
1236
1237 #[doc(alias = "g_shell_quote")]
shell_quote<P: AsRef<std::ffi::OsStr>>(unquoted_string: P) -> std::ffi::OsString1238 pub fn shell_quote<P: AsRef<std::ffi::OsStr>>(unquoted_string: P) -> std::ffi::OsString {
1239 unsafe {
1240 from_glib_full(ffi::g_shell_quote(
1241 unquoted_string.as_ref().to_glib_none().0,
1242 ))
1243 }
1244 }
1245
1246 #[doc(alias = "g_shell_unquote")]
shell_unquote<P: AsRef<std::ffi::OsStr>>( quoted_string: P, ) -> Result<std::ffi::OsString, crate::Error>1247 pub fn shell_unquote<P: AsRef<std::ffi::OsStr>>(
1248 quoted_string: P,
1249 ) -> Result<std::ffi::OsString, crate::Error> {
1250 unsafe {
1251 let mut error = ptr::null_mut();
1252 let ret = ffi::g_shell_unquote(quoted_string.as_ref().to_glib_none().0, &mut error);
1253 if error.is_null() {
1254 Ok(from_glib_full(ret))
1255 } else {
1256 Err(from_glib_full(error))
1257 }
1258 }
1259 }
1260
1261 //#[doc(alias = "g_slice_alloc")]
1262 //pub fn slice_alloc(block_size: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1263 // unsafe { TODO: call ffi:g_slice_alloc() }
1264 //}
1265
1266 //#[doc(alias = "g_slice_alloc0")]
1267 //pub fn slice_alloc0(block_size: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1268 // unsafe { TODO: call ffi:g_slice_alloc0() }
1269 //}
1270
1271 //#[doc(alias = "g_slice_copy")]
1272 //pub fn slice_copy(block_size: usize, mem_block: /*Unimplemented*/Option<Fundamental: Pointer>) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1273 // unsafe { TODO: call ffi:g_slice_copy() }
1274 //}
1275
1276 //#[doc(alias = "g_slice_free1")]
1277 //pub fn slice_free1(block_size: usize, mem_block: /*Unimplemented*/Option<Fundamental: Pointer>) {
1278 // unsafe { TODO: call ffi:g_slice_free1() }
1279 //}
1280
1281 //#[doc(alias = "g_slice_free_chain_with_offset")]
1282 //pub fn slice_free_chain_with_offset(block_size: usize, mem_chain: /*Unimplemented*/Option<Fundamental: Pointer>, next_offset: usize) {
1283 // unsafe { TODO: call ffi:g_slice_free_chain_with_offset() }
1284 //}
1285
1286 //#[doc(alias = "g_slice_get_config")]
1287 //pub fn slice_get_config(ckey: /*Ignored*/SliceConfig) -> i64 {
1288 // unsafe { TODO: call ffi:g_slice_get_config() }
1289 //}
1290
1291 //#[doc(alias = "g_slice_get_config_state")]
1292 //pub fn slice_get_config_state(ckey: /*Ignored*/SliceConfig, address: i64, n_values: u32) -> i64 {
1293 // unsafe { TODO: call ffi:g_slice_get_config_state() }
1294 //}
1295
1296 //#[doc(alias = "g_slice_set_config")]
1297 //pub fn slice_set_config(ckey: /*Ignored*/SliceConfig, value: i64) {
1298 // unsafe { TODO: call ffi:g_slice_set_config() }
1299 //}
1300
1301 //#[doc(alias = "g_snprintf")]
1302 //pub fn snprintf(string: &str, n: libc::c_ulong, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> i32 {
1303 // unsafe { TODO: call ffi:g_snprintf() }
1304 //}
1305
1306 #[doc(alias = "g_spaced_primes_closest")]
spaced_primes_closest(num: u32) -> u321307 pub fn spaced_primes_closest(num: u32) -> u32 {
1308 unsafe { ffi::g_spaced_primes_closest(num) }
1309 }
1310
1311 #[doc(alias = "g_spawn_async")]
spawn_async<P: AsRef<std::path::Path>>( working_directory: P, argv: &[&std::path::Path], envp: &[&std::path::Path], flags: SpawnFlags, child_setup: Option<Box_<dyn FnOnce() + 'static>>, ) -> Result<Pid, crate::Error>1312 pub fn spawn_async<P: AsRef<std::path::Path>>(
1313 working_directory: P,
1314 argv: &[&std::path::Path],
1315 envp: &[&std::path::Path],
1316 flags: SpawnFlags,
1317 child_setup: Option<Box_<dyn FnOnce() + 'static>>,
1318 ) -> Result<Pid, crate::Error> {
1319 let child_setup_data: Box_<Option<Box_<dyn FnOnce() + 'static>>> = Box_::new(child_setup);
1320 unsafe extern "C" fn child_setup_func<P: AsRef<std::path::Path>>(user_data: ffi::gpointer) {
1321 let callback: Box_<Option<Box_<dyn FnOnce() + 'static>>> =
1322 Box_::from_raw(user_data as *mut _);
1323 let callback = (*callback).expect("cannot get closure...");
1324 callback()
1325 }
1326 let child_setup = if child_setup_data.is_some() {
1327 Some(child_setup_func::<P> as _)
1328 } else {
1329 None
1330 };
1331 let super_callback0: Box_<Option<Box_<dyn FnOnce() + 'static>>> = child_setup_data;
1332 unsafe {
1333 let mut child_pid = mem::MaybeUninit::uninit();
1334 let mut error = ptr::null_mut();
1335 let _ = ffi::g_spawn_async(
1336 working_directory.as_ref().to_glib_none().0,
1337 argv.to_glib_none().0,
1338 envp.to_glib_none().0,
1339 flags.into_glib(),
1340 child_setup,
1341 Box_::into_raw(super_callback0) as *mut _,
1342 child_pid.as_mut_ptr(),
1343 &mut error,
1344 );
1345 let child_pid = from_glib(child_pid.assume_init());
1346 if error.is_null() {
1347 Ok(child_pid)
1348 } else {
1349 Err(from_glib_full(error))
1350 }
1351 }
1352 }
1353
1354 #[doc(alias = "g_spawn_check_exit_status")]
spawn_check_exit_status(exit_status: i32) -> Result<(), crate::Error>1355 pub fn spawn_check_exit_status(exit_status: i32) -> Result<(), crate::Error> {
1356 unsafe {
1357 let mut error = ptr::null_mut();
1358 let _ = ffi::g_spawn_check_exit_status(exit_status, &mut error);
1359 if error.is_null() {
1360 Ok(())
1361 } else {
1362 Err(from_glib_full(error))
1363 }
1364 }
1365 }
1366
1367 #[cfg(any(unix, feature = "dox"))]
1368 #[cfg_attr(feature = "dox", doc(cfg(unix)))]
1369 #[doc(alias = "g_spawn_command_line_async")]
spawn_command_line_async<P: AsRef<std::ffi::OsStr>>( command_line: P, ) -> Result<(), crate::Error>1370 pub fn spawn_command_line_async<P: AsRef<std::ffi::OsStr>>(
1371 command_line: P,
1372 ) -> Result<(), crate::Error> {
1373 unsafe {
1374 let mut error = ptr::null_mut();
1375 let _ = ffi::g_spawn_command_line_async(command_line.as_ref().to_glib_none().0, &mut error);
1376 if error.is_null() {
1377 Ok(())
1378 } else {
1379 Err(from_glib_full(error))
1380 }
1381 }
1382 }
1383
1384 //#[doc(alias = "g_spawn_command_line_sync")]
1385 //pub fn spawn_command_line_sync<P: AsRef<std::path::Path>>(command_line: P, standard_output: Vec<u8>, standard_error: Vec<u8>) -> Result<i32, crate::Error> {
1386 // unsafe { TODO: call ffi:g_spawn_command_line_sync() }
1387 //}
1388
1389 //#[doc(alias = "g_spawn_sync")]
1390 //pub fn spawn_sync<P: AsRef<std::path::Path>>(working_directory: P, argv: &[&std::path::Path], envp: &[&std::path::Path], flags: SpawnFlags, child_setup: Option<Box_<dyn FnOnce() + 'static>>, standard_output: Vec<u8>, standard_error: Vec<u8>) -> Result<i32, crate::Error> {
1391 // unsafe { TODO: call ffi:g_spawn_sync() }
1392 //}
1393
1394 //#[doc(alias = "g_sprintf")]
1395 //pub fn sprintf(string: &str, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> i32 {
1396 // unsafe { TODO: call ffi:g_sprintf() }
1397 //}
1398
1399 #[doc(alias = "g_stpcpy")]
stpcpy(dest: &str, src: &str) -> crate::GString1400 pub fn stpcpy(dest: &str, src: &str) -> crate::GString {
1401 unsafe { from_glib_full(ffi::g_stpcpy(dest.to_glib_none().0, src.to_glib_none().0)) }
1402 }
1403
1404 //#[doc(alias = "g_try_malloc")]
1405 //pub fn try_malloc(n_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1406 // unsafe { TODO: call ffi:g_try_malloc() }
1407 //}
1408
1409 //#[doc(alias = "g_try_malloc0")]
1410 //pub fn try_malloc0(n_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1411 // unsafe { TODO: call ffi:g_try_malloc0() }
1412 //}
1413
1414 //#[doc(alias = "g_try_malloc0_n")]
1415 //pub fn try_malloc0_n(n_blocks: usize, n_block_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1416 // unsafe { TODO: call ffi:g_try_malloc0_n() }
1417 //}
1418
1419 //#[doc(alias = "g_try_malloc_n")]
1420 //pub fn try_malloc_n(n_blocks: usize, n_block_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1421 // unsafe { TODO: call ffi:g_try_malloc_n() }
1422 //}
1423
1424 //#[doc(alias = "g_try_realloc")]
1425 //pub fn try_realloc(mem: /*Unimplemented*/Option<Fundamental: Pointer>, n_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1426 // unsafe { TODO: call ffi:g_try_realloc() }
1427 //}
1428
1429 //#[doc(alias = "g_try_realloc_n")]
1430 //pub fn try_realloc_n(mem: /*Unimplemented*/Option<Fundamental: Pointer>, n_blocks: usize, n_block_bytes: usize) -> /*Unimplemented*/Option<Fundamental: Pointer> {
1431 // unsafe { TODO: call ffi:g_try_realloc_n() }
1432 //}
1433
1434 //#[doc(alias = "g_unicode_script_from_iso15924")]
1435 //pub fn unicode_script_from_iso15924(iso15924: u32) -> /*Ignored*/UnicodeScript {
1436 // unsafe { TODO: call ffi:g_unicode_script_from_iso15924() }
1437 //}
1438
1439 //#[doc(alias = "g_unicode_script_to_iso15924")]
1440 //pub fn unicode_script_to_iso15924(script: /*Ignored*/UnicodeScript) -> u32 {
1441 // unsafe { TODO: call ffi:g_unicode_script_to_iso15924() }
1442 //}
1443
1444 //#[cfg(any(unix, feature = "dox"))]
1445 //#[cfg_attr(feature = "dox", doc(cfg(unix)))]
1446 //#[cfg(any(feature = "v2_64", feature = "dox"))]
1447 //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_64")))]
1448 //#[doc(alias = "g_unix_get_passwd_entry")]
1449 //pub fn unix_get_passwd_entry(user_name: &str) -> Result</*Unimplemented*/Option<Fundamental: Pointer>, crate::Error> {
1450 // unsafe { TODO: call ffi:g_unix_get_passwd_entry() }
1451 //}
1452
1453 #[doc(alias = "g_unlink")]
unlink<P: AsRef<std::path::Path>>(filename: P) -> i321454 pub fn unlink<P: AsRef<std::path::Path>>(filename: P) -> i32 {
1455 unsafe { ffi::g_unlink(filename.as_ref().to_glib_none().0) }
1456 }
1457
1458 #[doc(alias = "g_usleep")]
usleep(microseconds: libc::c_ulong)1459 pub fn usleep(microseconds: libc::c_ulong) {
1460 unsafe {
1461 ffi::g_usleep(microseconds);
1462 }
1463 }
1464
1465 #[cfg(any(feature = "v2_52", feature = "dox"))]
1466 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_52")))]
1467 #[doc(alias = "g_uuid_string_is_valid")]
uuid_string_is_valid(str: &str) -> bool1468 pub fn uuid_string_is_valid(str: &str) -> bool {
1469 unsafe { from_glib(ffi::g_uuid_string_is_valid(str.to_glib_none().0)) }
1470 }
1471
1472 #[cfg(any(feature = "v2_52", feature = "dox"))]
1473 #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_52")))]
1474 #[doc(alias = "g_uuid_string_random")]
uuid_string_random() -> crate::GString1475 pub fn uuid_string_random() -> crate::GString {
1476 unsafe { from_glib_full(ffi::g_uuid_string_random()) }
1477 }
1478
1479 //#[doc(alias = "g_vasprintf")]
1480 //pub fn vasprintf(string: &str, format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> i32 {
1481 // unsafe { TODO: call ffi:g_vasprintf() }
1482 //}
1483
1484 //#[doc(alias = "g_vfprintf")]
1485 //pub fn vfprintf(file: /*Unimplemented*/Fundamental: Pointer, format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> i32 {
1486 // unsafe { TODO: call ffi:g_vfprintf() }
1487 //}
1488
1489 //#[doc(alias = "g_vprintf")]
1490 //pub fn vprintf(format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> i32 {
1491 // unsafe { TODO: call ffi:g_vprintf() }
1492 //}
1493
1494 //#[doc(alias = "g_vsnprintf")]
1495 //pub fn vsnprintf(string: &str, n: libc::c_ulong, format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> i32 {
1496 // unsafe { TODO: call ffi:g_vsnprintf() }
1497 //}
1498
1499 //#[doc(alias = "g_vsprintf")]
1500 //pub fn vsprintf(string: &str, format: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> i32 {
1501 // unsafe { TODO: call ffi:g_vsprintf() }
1502 //}
1503
1504 #[doc(alias = "g_warn_message")]
warn_message( domain: Option<&str>, file: &str, line: i32, func: &str, warnexpr: Option<&str>, )1505 pub fn warn_message(
1506 domain: Option<&str>,
1507 file: &str,
1508 line: i32,
1509 func: &str,
1510 warnexpr: Option<&str>,
1511 ) {
1512 unsafe {
1513 ffi::g_warn_message(
1514 domain.to_glib_none().0,
1515 file.to_glib_none().0,
1516 line,
1517 func.to_glib_none().0,
1518 warnexpr.to_glib_none().0,
1519 );
1520 }
1521 }
1522