1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::translate::*;
use crate::value::FromValue;
use crate::value::ToValue;
use crate::StaticType;
use crate::Type;
use bitflags::bitflags;
use std::fmt;

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
bitflags! {
    /// Flags to pass to [`file_set_contents_full()`][crate::file_set_contents_full()] to affect its safety and
    /// performance.
    #[doc(alias = "GFileSetContentsFlags")]
    pub struct FileSetContentsFlags: u32 {
        /// No guarantees about file consistency or durability.
        ///  The most dangerous setting, which is slightly faster than other settings.
        #[doc(alias = "G_FILE_SET_CONTENTS_NONE")]
        const NONE = ffi::G_FILE_SET_CONTENTS_NONE as u32;
        /// Guarantee file consistency: after a crash,
        ///  either the old version of the file or the new version of the file will be
        ///  available, but not a mixture. On Unix systems this equates to an ``fsync()``
        ///  on the file and use of an atomic ``rename()`` of the new version of the file
        ///  over the old.
        #[doc(alias = "G_FILE_SET_CONTENTS_CONSISTENT")]
        const CONSISTENT = ffi::G_FILE_SET_CONTENTS_CONSISTENT as u32;
        /// Guarantee file durability: after a crash, the
        ///  new version of the file will be available. On Unix systems this equates to
        ///  an ``fsync()`` on the file (if [`CONSISTENT`][Self::CONSISTENT] is unset), or
        ///  the effects of [`CONSISTENT`][Self::CONSISTENT] plus an ``fsync()`` on the
        ///  directory containing the file after calling ``rename()``.
        #[doc(alias = "G_FILE_SET_CONTENTS_DURABLE")]
        const DURABLE = ffi::G_FILE_SET_CONTENTS_DURABLE as u32;
        /// Only apply consistency and durability
        ///  guarantees if the file already exists. This may speed up file operations
        ///  if the file doesn’t currently exist, but may result in a corrupted version
        ///  of the new file if the system crashes while writing it.
        #[doc(alias = "G_FILE_SET_CONTENTS_ONLY_EXISTING")]
        const ONLY_EXISTING = ffi::G_FILE_SET_CONTENTS_ONLY_EXISTING as u32;
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
impl fmt::Display for FileSetContentsFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl IntoGlib for FileSetContentsFlags {
    type GlibType = ffi::GFileSetContentsFlags;

    fn into_glib(self) -> ffi::GFileSetContentsFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl FromGlib<ffi::GFileSetContentsFlags> for FileSetContentsFlags {
    unsafe fn from_glib(value: ffi::GFileSetContentsFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// A test to perform on a file using [`file_test()`][crate::file_test()].
    #[doc(alias = "GFileTest")]
    pub struct FileTest: u32 {
        /// [`true`] if the file is a regular file
        ///  (not a directory). Note that this test will also return [`true`]
        ///  if the tested file is a symlink to a regular file.
        #[doc(alias = "G_FILE_TEST_IS_REGULAR")]
        const IS_REGULAR = ffi::G_FILE_TEST_IS_REGULAR as u32;
        /// [`true`] if the file is a symlink.
        #[doc(alias = "G_FILE_TEST_IS_SYMLINK")]
        const IS_SYMLINK = ffi::G_FILE_TEST_IS_SYMLINK as u32;
        /// [`true`] if the file is a directory.
        #[doc(alias = "G_FILE_TEST_IS_DIR")]
        const IS_DIR = ffi::G_FILE_TEST_IS_DIR as u32;
        /// [`true`] if the file is executable.
        #[doc(alias = "G_FILE_TEST_IS_EXECUTABLE")]
        const IS_EXECUTABLE = ffi::G_FILE_TEST_IS_EXECUTABLE as u32;
        /// [`true`] if the file exists. It may or may not
        ///  be a regular file.
        #[doc(alias = "G_FILE_TEST_EXISTS")]
        const EXISTS = ffi::G_FILE_TEST_EXISTS as u32;
    }
}

impl fmt::Display for FileTest {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileTest {
    type GlibType = ffi::GFileTest;

    fn into_glib(self) -> ffi::GFileTest {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileTest> for FileTest {
    unsafe fn from_glib(value: ffi::GFileTest) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// Flags to modify the format of the string returned by [`format_size_full()`][crate::format_size_full()].
    #[doc(alias = "GFormatSizeFlags")]
    pub struct FormatSizeFlags: u32 {
        /// behave the same as [`format_size()`][crate::format_size()]
        #[doc(alias = "G_FORMAT_SIZE_DEFAULT")]
        const DEFAULT = ffi::G_FORMAT_SIZE_DEFAULT as u32;
        /// include the exact number of bytes as part
        ///  of the returned string. For example, "45.6 kB (45,612 bytes)".
        #[doc(alias = "G_FORMAT_SIZE_LONG_FORMAT")]
        const LONG_FORMAT = ffi::G_FORMAT_SIZE_LONG_FORMAT as u32;
        /// use IEC (base 1024) units with "KiB"-style
        ///  suffixes. IEC units should only be used for reporting things with
        ///  a strong "power of 2" basis, like RAM sizes or RAID stripe sizes.
        ///  Network and storage sizes should be reported in the normal SI units.
        #[doc(alias = "G_FORMAT_SIZE_IEC_UNITS")]
        const IEC_UNITS = ffi::G_FORMAT_SIZE_IEC_UNITS as u32;
        /// set the size as a quantity in bits, rather than
        ///  bytes, and return units in bits. For example, ‘Mb’ rather than ‘MB’.
        #[doc(alias = "G_FORMAT_SIZE_BITS")]
        const BITS = ffi::G_FORMAT_SIZE_BITS as u32;
    }
}

impl fmt::Display for FormatSizeFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FormatSizeFlags {
    type GlibType = ffi::GFormatSizeFlags;

    fn into_glib(self) -> ffi::GFormatSizeFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFormatSizeFlags> for FormatSizeFlags {
    unsafe fn from_glib(value: ffi::GFormatSizeFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// A bitwise combination representing a condition to watch for on an
    /// event source.
    #[doc(alias = "GIOCondition")]
    pub struct IOCondition: u32 {
        /// There is data to read.
        #[doc(alias = "G_IO_IN")]
        const IN = ffi::G_IO_IN as u32;
        /// Data can be written (without blocking).
        #[doc(alias = "G_IO_OUT")]
        const OUT = ffi::G_IO_OUT as u32;
        /// There is urgent data to read.
        #[doc(alias = "G_IO_PRI")]
        const PRI = ffi::G_IO_PRI as u32;
        /// Error condition.
        #[doc(alias = "G_IO_ERR")]
        const ERR = ffi::G_IO_ERR as u32;
        /// Hung up (the connection has been broken, usually for
        ///  pipes and sockets).
        #[doc(alias = "G_IO_HUP")]
        const HUP = ffi::G_IO_HUP as u32;
        /// Invalid request. The file descriptor is not open.
        #[doc(alias = "G_IO_NVAL")]
        const NVAL = ffi::G_IO_NVAL as u32;
    }
}

impl fmt::Display for IOCondition {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for IOCondition {
    type GlibType = ffi::GIOCondition;

    fn into_glib(self) -> ffi::GIOCondition {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GIOCondition> for IOCondition {
    unsafe fn from_glib(value: ffi::GIOCondition) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for IOCondition {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_io_condition_get_type()) }
    }
}

impl crate::value::ValueType for IOCondition {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for IOCondition {
    type Checker = crate::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a crate::Value) -> Self {
        from_glib(crate::gobject_ffi::g_value_get_flags(
            value.to_glib_none().0,
        ))
    }
}

impl ToValue for IOCondition {
    fn to_value(&self) -> crate::Value {
        let mut value = crate::Value::for_value_type::<Self>();
        unsafe {
            crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> crate::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags which influence the parsing.
    #[doc(alias = "GKeyFileFlags")]
    pub struct KeyFileFlags: u32 {
        /// No flags, default behaviour
        #[doc(alias = "G_KEY_FILE_NONE")]
        const NONE = ffi::G_KEY_FILE_NONE as u32;
        /// Use this flag if you plan to write the
        ///  (possibly modified) contents of the key file back to a file;
        ///  otherwise all comments will be lost when the key file is
        ///  written back.
        #[doc(alias = "G_KEY_FILE_KEEP_COMMENTS")]
        const KEEP_COMMENTS = ffi::G_KEY_FILE_KEEP_COMMENTS as u32;
        /// Use this flag if you plan to write the
        ///  (possibly modified) contents of the key file back to a file;
        ///  otherwise only the translations for the current language will be
        ///  written back.
        #[doc(alias = "G_KEY_FILE_KEEP_TRANSLATIONS")]
        const KEEP_TRANSLATIONS = ffi::G_KEY_FILE_KEEP_TRANSLATIONS as u32;
    }
}

impl fmt::Display for KeyFileFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for KeyFileFlags {
    type GlibType = ffi::GKeyFileFlags;

    fn into_glib(self) -> ffi::GKeyFileFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GKeyFileFlags> for KeyFileFlags {
    unsafe fn from_glib(value: ffi::GKeyFileFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// Flags specifying the level of log messages.
    ///
    /// It is possible to change how GLib treats messages of the various
    /// levels using `g_log_set_handler()` and `g_log_set_fatal_mask()`.
    #[doc(alias = "GLogLevelFlags")]
    pub struct LogLevelFlags: u32 {
        /// internal flag
        #[doc(alias = "G_LOG_FLAG_RECURSION")]
        const FLAG_RECURSION = ffi::G_LOG_FLAG_RECURSION as u32;
        /// internal flag
        #[doc(alias = "G_LOG_FLAG_FATAL")]
        const FLAG_FATAL = ffi::G_LOG_FLAG_FATAL as u32;
        /// log level for errors, see `g_error()`.
        ///  This level is also used for messages produced by `g_assert()`.
        #[doc(alias = "G_LOG_LEVEL_ERROR")]
        const LEVEL_ERROR = ffi::G_LOG_LEVEL_ERROR as u32;
        /// log level for critical warning messages, see
        ///  `g_critical()`.
        ///  This level is also used for messages produced by `g_return_if_fail()`
        ///  and `g_return_val_if_fail()`.
        #[doc(alias = "G_LOG_LEVEL_CRITICAL")]
        const LEVEL_CRITICAL = ffi::G_LOG_LEVEL_CRITICAL as u32;
        /// log level for warnings, see `g_warning()`
        #[doc(alias = "G_LOG_LEVEL_WARNING")]
        const LEVEL_WARNING = ffi::G_LOG_LEVEL_WARNING as u32;
        /// log level for messages, see `g_message()`
        #[doc(alias = "G_LOG_LEVEL_MESSAGE")]
        const LEVEL_MESSAGE = ffi::G_LOG_LEVEL_MESSAGE as u32;
        /// log level for informational messages, see `g_info()`
        #[doc(alias = "G_LOG_LEVEL_INFO")]
        const LEVEL_INFO = ffi::G_LOG_LEVEL_INFO as u32;
        /// log level for debug messages, see `g_debug()`
        #[doc(alias = "G_LOG_LEVEL_DEBUG")]
        const LEVEL_DEBUG = ffi::G_LOG_LEVEL_DEBUG as u32;
        /// a mask including all log levels
        #[doc(alias = "G_LOG_LEVEL_MASK")]
        const LEVEL_MASK = ffi::G_LOG_LEVEL_MASK as u32;
    }
}

impl fmt::Display for LogLevelFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for LogLevelFlags {
    type GlibType = ffi::GLogLevelFlags;

    fn into_glib(self) -> ffi::GLogLevelFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GLogLevelFlags> for LogLevelFlags {
    unsafe fn from_glib(value: ffi::GLogLevelFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// Flags which modify individual options.
    #[doc(alias = "GOptionFlags")]
    pub struct OptionFlags: u32 {
        /// No flags. Since: 2.42.
        #[doc(alias = "G_OPTION_FLAG_NONE")]
        const NONE = ffi::G_OPTION_FLAG_NONE as u32;
        /// The option doesn't appear in `--help` output.
        #[doc(alias = "G_OPTION_FLAG_HIDDEN")]
        const HIDDEN = ffi::G_OPTION_FLAG_HIDDEN as u32;
        /// The option appears in the main section of the
        ///  `--help` output, even if it is defined in a group.
        #[doc(alias = "G_OPTION_FLAG_IN_MAIN")]
        const IN_MAIN = ffi::G_OPTION_FLAG_IN_MAIN as u32;
        /// For options of the [`OptionArg::None`][crate::OptionArg::None] kind, this
        ///  flag indicates that the sense of the option is reversed.
        #[doc(alias = "G_OPTION_FLAG_REVERSE")]
        const REVERSE = ffi::G_OPTION_FLAG_REVERSE as u32;
        /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback] kind,
        ///  this flag indicates that the callback does not take any argument
        ///  (like a [`OptionArg::None`][crate::OptionArg::None] option). Since 2.8
        #[doc(alias = "G_OPTION_FLAG_NO_ARG")]
        const NO_ARG = ffi::G_OPTION_FLAG_NO_ARG as u32;
        /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback]
        ///  kind, this flag indicates that the argument should be passed to the
        ///  callback in the GLib filename encoding rather than UTF-8. Since 2.8
        #[doc(alias = "G_OPTION_FLAG_FILENAME")]
        const FILENAME = ffi::G_OPTION_FLAG_FILENAME as u32;
        /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback]
        ///  kind, this flag indicates that the argument supply is optional.
        ///  If no argument is given then data of `GOptionParseFunc` will be
        ///  set to NULL. Since 2.8
        #[doc(alias = "G_OPTION_FLAG_OPTIONAL_ARG")]
        const OPTIONAL_ARG = ffi::G_OPTION_FLAG_OPTIONAL_ARG as u32;
        /// This flag turns off the automatic conflict
        ///  resolution which prefixes long option names with `groupname-` if
        ///  there is a conflict. This option should only be used in situations
        ///  where aliasing is necessary to model some legacy commandline interface.
        ///  It is not safe to use this option, unless all option groups are under
        ///  your direct control. Since 2.8.
        #[doc(alias = "G_OPTION_FLAG_NOALIAS")]
        const NOALIAS = ffi::G_OPTION_FLAG_NOALIAS as u32;
    }
}

impl fmt::Display for OptionFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for OptionFlags {
    type GlibType = ffi::GOptionFlags;

    fn into_glib(self) -> ffi::GOptionFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GOptionFlags> for OptionFlags {
    unsafe fn from_glib(value: ffi::GOptionFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// Flags passed to `g_spawn_sync()`, [`spawn_async()`][crate::spawn_async()] and `g_spawn_async_with_pipes()`.
    #[doc(alias = "GSpawnFlags")]
    pub struct SpawnFlags: u32 {
        /// no flags, default behaviour
        #[doc(alias = "G_SPAWN_DEFAULT")]
        const DEFAULT = ffi::G_SPAWN_DEFAULT as u32;
        /// the parent's open file descriptors will
        ///  be inherited by the child; otherwise all descriptors except stdin,
        ///  stdout and stderr will be closed before calling `exec()` in the child.
        #[doc(alias = "G_SPAWN_LEAVE_DESCRIPTORS_OPEN")]
        const LEAVE_DESCRIPTORS_OPEN = ffi::G_SPAWN_LEAVE_DESCRIPTORS_OPEN as u32;
        /// the child will not be automatically reaped;
        ///  you must use `g_child_watch_add()` yourself (or call `waitpid()` or handle
        ///  `SIGCHLD` yourself), or the child will become a zombie.
        #[doc(alias = "G_SPAWN_DO_NOT_REAP_CHILD")]
        const DO_NOT_REAP_CHILD = ffi::G_SPAWN_DO_NOT_REAP_CHILD as u32;
        /// `argv[0]` need not be an absolute path, it will be
        ///  looked for in the user's `PATH`.
        #[doc(alias = "G_SPAWN_SEARCH_PATH")]
        const SEARCH_PATH = ffi::G_SPAWN_SEARCH_PATH as u32;
        /// the child's standard output will be discarded,
        ///  instead of going to the same location as the parent's standard output.
        #[doc(alias = "G_SPAWN_STDOUT_TO_DEV_NULL")]
        const STDOUT_TO_DEV_NULL = ffi::G_SPAWN_STDOUT_TO_DEV_NULL as u32;
        /// the child's standard error will be discarded.
        #[doc(alias = "G_SPAWN_STDERR_TO_DEV_NULL")]
        const STDERR_TO_DEV_NULL = ffi::G_SPAWN_STDERR_TO_DEV_NULL as u32;
        /// the child will inherit the parent's standard
        ///  input (by default, the child's standard input is attached to `/dev/null`).
        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDIN")]
        const CHILD_INHERITS_STDIN = ffi::G_SPAWN_CHILD_INHERITS_STDIN as u32;
        /// the first element of `argv` is the file to
        ///  execute, while the remaining elements are the actual argument vector
        ///  to pass to the file. Normally `g_spawn_async_with_pipes()` uses `argv[0]`
        ///  as the file to execute, and passes all of `argv` to the child.
        #[doc(alias = "G_SPAWN_FILE_AND_ARGV_ZERO")]
        const FILE_AND_ARGV_ZERO = ffi::G_SPAWN_FILE_AND_ARGV_ZERO as u32;
        /// if `argv[0]` is not an absolute path,
        ///  it will be looked for in the `PATH` from the passed child environment.
        ///  Since: 2.34
        #[doc(alias = "G_SPAWN_SEARCH_PATH_FROM_ENVP")]
        const SEARCH_PATH_FROM_ENVP = ffi::G_SPAWN_SEARCH_PATH_FROM_ENVP as u32;
        /// create all pipes with the `O_CLOEXEC` flag set.
        ///  Since: 2.40
        #[doc(alias = "G_SPAWN_CLOEXEC_PIPES")]
        const CLOEXEC_PIPES = ffi::G_SPAWN_CLOEXEC_PIPES as u32;
    }
}

impl fmt::Display for SpawnFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for SpawnFlags {
    type GlibType = ffi::GSpawnFlags;

    fn into_glib(self) -> ffi::GSpawnFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GSpawnFlags> for SpawnFlags {
    unsafe fn from_glib(value: ffi::GSpawnFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
bitflags! {
    /// Flags that describe a URI.
    ///
    /// When parsing a URI, if you need to choose different flags based on
    /// the type of URI, you can use [`Uri::peek_scheme()`][crate::Uri::peek_scheme()] on the URI string
    /// to check the scheme first, and use that to decide what flags to
    /// parse it with.
    #[doc(alias = "GUriFlags")]
    pub struct UriFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_URI_FLAGS_NONE")]
        const NONE = ffi::G_URI_FLAGS_NONE as u32;
        /// Parse the URI more relaxedly than the
        ///  [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies,
        ///  fixing up or ignoring common mistakes in URIs coming from external
        ///  sources. This is also needed for some obscure URI schemes where `;`
        ///  separates the host from the path. Don’t use this flag unless you need to.
        #[doc(alias = "G_URI_FLAGS_PARSE_RELAXED")]
        const PARSE_RELAXED = ffi::G_URI_FLAGS_PARSE_RELAXED as u32;
        /// The userinfo field may contain a password,
        ///  which will be separated from the username by `:`.
        #[doc(alias = "G_URI_FLAGS_HAS_PASSWORD")]
        const HAS_PASSWORD = ffi::G_URI_FLAGS_HAS_PASSWORD as u32;
        /// The userinfo may contain additional
        ///  authentication-related parameters, which will be separated from
        ///  the username and/or password by `;`.
        #[doc(alias = "G_URI_FLAGS_HAS_AUTH_PARAMS")]
        const HAS_AUTH_PARAMS = ffi::G_URI_FLAGS_HAS_AUTH_PARAMS as u32;
        /// When parsing a URI, this indicates that `%`-encoded
        ///  characters in the userinfo, path, query, and fragment fields
        ///  should not be decoded. (And likewise the host field if
        ///  [`NON_DNS`][Self::NON_DNS] is also set.) When building a URI, it indicates
        ///  that you have already `%`-encoded the components, and so [`Uri`][crate::Uri]
        ///  should not do any encoding itself.
        #[doc(alias = "G_URI_FLAGS_ENCODED")]
        const ENCODED = ffi::G_URI_FLAGS_ENCODED as u32;
        /// The host component should not be assumed to be a
        ///  DNS hostname or IP address (for example, for `smb` URIs with NetBIOS
        ///  hostnames).
        #[doc(alias = "G_URI_FLAGS_NON_DNS")]
        const NON_DNS = ffi::G_URI_FLAGS_NON_DNS as u32;
        /// Same as [`ENCODED`][Self::ENCODED], for the query
        ///  field only.
        #[doc(alias = "G_URI_FLAGS_ENCODED_QUERY")]
        const ENCODED_QUERY = ffi::G_URI_FLAGS_ENCODED_QUERY as u32;
        /// Same as [`ENCODED`][Self::ENCODED], for the path only.
        #[doc(alias = "G_URI_FLAGS_ENCODED_PATH")]
        const ENCODED_PATH = ffi::G_URI_FLAGS_ENCODED_PATH as u32;
        /// Same as [`ENCODED`][Self::ENCODED], for the
        ///  fragment only.
        #[doc(alias = "G_URI_FLAGS_ENCODED_FRAGMENT")]
        const ENCODED_FRAGMENT = ffi::G_URI_FLAGS_ENCODED_FRAGMENT as u32;
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
impl fmt::Display for UriFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl IntoGlib for UriFlags {
    type GlibType = ffi::GUriFlags;

    fn into_glib(self) -> ffi::GUriFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl FromGlib<ffi::GUriFlags> for UriFlags {
    unsafe fn from_glib(value: ffi::GUriFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
bitflags! {
    /// Flags describing what parts of the URI to hide in
    /// [`Uri::to_string_partial()`][crate::Uri::to_string_partial()]. Note that [`PASSWORD`][Self::PASSWORD] and
    /// [`AUTH_PARAMS`][Self::AUTH_PARAMS] will only work if the [`Uri`][crate::Uri] was parsed with
    /// the corresponding flags.
    #[doc(alias = "GUriHideFlags")]
    pub struct UriHideFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_URI_HIDE_NONE")]
        const NONE = ffi::G_URI_HIDE_NONE as u32;
        /// Hide the userinfo.
        #[doc(alias = "G_URI_HIDE_USERINFO")]
        const USERINFO = ffi::G_URI_HIDE_USERINFO as u32;
        /// Hide the password.
        #[doc(alias = "G_URI_HIDE_PASSWORD")]
        const PASSWORD = ffi::G_URI_HIDE_PASSWORD as u32;
        /// Hide the auth_params.
        #[doc(alias = "G_URI_HIDE_AUTH_PARAMS")]
        const AUTH_PARAMS = ffi::G_URI_HIDE_AUTH_PARAMS as u32;
        /// Hide the query.
        #[doc(alias = "G_URI_HIDE_QUERY")]
        const QUERY = ffi::G_URI_HIDE_QUERY as u32;
        /// Hide the fragment.
        #[doc(alias = "G_URI_HIDE_FRAGMENT")]
        const FRAGMENT = ffi::G_URI_HIDE_FRAGMENT as u32;
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
impl fmt::Display for UriHideFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl IntoGlib for UriHideFlags {
    type GlibType = ffi::GUriHideFlags;

    fn into_glib(self) -> ffi::GUriHideFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl FromGlib<ffi::GUriHideFlags> for UriHideFlags {
    unsafe fn from_glib(value: ffi::GUriHideFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
bitflags! {
    /// Flags modifying the way parameters are handled by `g_uri_parse_params()` and
    /// `GUriParamsIter`.
    #[doc(alias = "GUriParamsFlags")]
    pub struct UriParamsFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_URI_PARAMS_NONE")]
        const NONE = ffi::G_URI_PARAMS_NONE as u32;
        /// Parameter names are case insensitive.
        #[doc(alias = "G_URI_PARAMS_CASE_INSENSITIVE")]
        const CASE_INSENSITIVE = ffi::G_URI_PARAMS_CASE_INSENSITIVE as u32;
        /// Replace `+` with space character. Only useful for
        ///  URLs on the web, using the `https` or `http` schemas.
        #[doc(alias = "G_URI_PARAMS_WWW_FORM")]
        const WWW_FORM = ffi::G_URI_PARAMS_WWW_FORM as u32;
        /// See [`UriFlags::PARSE_RELAXED`][crate::UriFlags::PARSE_RELAXED].
        #[doc(alias = "G_URI_PARAMS_PARSE_RELAXED")]
        const PARSE_RELAXED = ffi::G_URI_PARAMS_PARSE_RELAXED as u32;
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
impl fmt::Display for UriParamsFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl IntoGlib for UriParamsFlags {
    type GlibType = ffi::GUriParamsFlags;

    fn into_glib(self) -> ffi::GUriParamsFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v2_66", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_66")))]
#[doc(hidden)]
impl FromGlib<ffi::GUriParamsFlags> for UriParamsFlags {
    unsafe fn from_glib(value: ffi::GUriParamsFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}