glib/auto/
flags.rs

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
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
// 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::{bitflags::bitflags, ffi, prelude::*, translate::*};

#[cfg(feature = "v2_66")]
bitflags! {
    /// Flags to pass to g_file_set_contents_full() to affect its safety and
    /// performance.
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GFileSetContentsFlags {
        self.bits()
    }
}

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

bitflags! {
    /// A test to perform on a file using g_file_test().
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GFileTest")]
    pub(crate) 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 _;
        /// [`true`] if the file is a symlink.
        #[doc(alias = "G_FILE_TEST_IS_SYMLINK")]
        const IS_SYMLINK = ffi::G_FILE_TEST_IS_SYMLINK as _;
        /// [`true`] if the file is a directory.
        #[doc(alias = "G_FILE_TEST_IS_DIR")]
        const IS_DIR = ffi::G_FILE_TEST_IS_DIR as _;
        /// [`true`] if the file is executable.
        #[doc(alias = "G_FILE_TEST_IS_EXECUTABLE")]
        const IS_EXECUTABLE = ffi::G_FILE_TEST_IS_EXECUTABLE as _;
        /// [`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 _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GFileTest {
        self.bits()
    }
}

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

bitflags! {
    /// Flags to modify the format of the string returned by g_format_size_full().
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GFormatSizeFlags")]
    pub struct FormatSizeFlags: u32 {
        /// behave the same as g_format_size()
        #[doc(alias = "G_FORMAT_SIZE_DEFAULT")]
        const DEFAULT = ffi::G_FORMAT_SIZE_DEFAULT as _;
        /// 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 _;
        /// 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 _;
        /// set the size as a quantity in bits, rather than
        ///     bytes, and return units in bits. For example, ‘Mbit’ rather than ‘MB’.
        #[doc(alias = "G_FORMAT_SIZE_BITS")]
        const BITS = ffi::G_FORMAT_SIZE_BITS as _;
        /// return only value, without unit; this should
        ///     not be used together with @G_FORMAT_SIZE_LONG_FORMAT
        ///     nor @G_FORMAT_SIZE_ONLY_UNIT. Since: 2.74
        #[cfg(feature = "v2_74")]
        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
        #[doc(alias = "G_FORMAT_SIZE_ONLY_VALUE")]
        const ONLY_VALUE = ffi::G_FORMAT_SIZE_ONLY_VALUE as _;
        /// return only unit, without value; this should
        ///     not be used together with @G_FORMAT_SIZE_LONG_FORMAT
        ///     nor @G_FORMAT_SIZE_ONLY_VALUE. Since: 2.74
        #[cfg(feature = "v2_74")]
        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
        #[doc(alias = "G_FORMAT_SIZE_ONLY_UNIT")]
        const ONLY_UNIT = ffi::G_FORMAT_SIZE_ONLY_UNIT as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GFormatSizeFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFormatSizeFlags> for FormatSizeFlags {
    #[inline]
    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.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GIOCondition")]
    pub struct IOCondition: u32 {
        /// There is data to read.
        #[doc(alias = "G_IO_IN")]
        const IN = ffi::G_IO_IN as _;
        /// Data can be written (without blocking).
        #[doc(alias = "G_IO_OUT")]
        const OUT = ffi::G_IO_OUT as _;
        /// There is urgent data to read.
        #[doc(alias = "G_IO_PRI")]
        const PRI = ffi::G_IO_PRI as _;
        /// Error condition.
        #[doc(alias = "G_IO_ERR")]
        const ERR = ffi::G_IO_ERR as _;
        /// Hung up (the connection has been broken, usually for
        ///            pipes and sockets).
        #[doc(alias = "G_IO_HUP")]
        const HUP = ffi::G_IO_HUP as _;
        /// Invalid request. The file descriptor is not open.
        #[doc(alias = "G_IO_NVAL")]
        const NVAL = ffi::G_IO_NVAL as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GIOCondition {
        self.bits()
    }
}

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

impl StaticType for IOCondition {
    #[inline]
    #[doc(alias = "g_io_condition_get_type")]
    fn static_type() -> crate::Type {
        unsafe { from_glib(ffi::g_io_condition_get_type()) }
    }
}

impl crate::HasParamSpec for IOCondition {
    type ParamSpec = crate::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> crate::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

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

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

    #[inline]
    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 {
    #[inline]
    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
    }

    #[inline]
    fn value_type(&self) -> crate::Type {
        Self::static_type()
    }
}

impl From<IOCondition> for crate::Value {
    #[inline]
    fn from(v: IOCondition) -> Self {
        ToValue::to_value(&v)
    }
}

bitflags! {
    /// Flags which influence the parsing.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[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 _;
        /// 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 _;
        /// 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 _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GKeyFileFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GKeyFileFlags> for KeyFileFlags {
    #[inline]
    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 `log_set_handler()` and `log_set_fatal_mask()`.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GLogLevelFlags")]
    pub struct LogLevelFlags: u32 {
        /// internal flag
        #[doc(alias = "G_LOG_FLAG_RECURSION")]
        const FLAG_RECURSION = ffi::G_LOG_FLAG_RECURSION as _;
        /// internal flag
        #[doc(alias = "G_LOG_FLAG_FATAL")]
        const FLAG_FATAL = ffi::G_LOG_FLAG_FATAL as _;
        /// log level for errors, see `error()`.
        ///   This level is also used for messages produced by `assert()`.
        #[doc(alias = "G_LOG_LEVEL_ERROR")]
        const LEVEL_ERROR = ffi::G_LOG_LEVEL_ERROR as _;
        /// log level for critical warning messages, see
        ///   `critical()`. This level is also used for messages produced by
        ///   `return_if_fail()` and `return_val_if_fail()`.
        #[doc(alias = "G_LOG_LEVEL_CRITICAL")]
        const LEVEL_CRITICAL = ffi::G_LOG_LEVEL_CRITICAL as _;
        /// log level for warnings, see `warning()`
        #[doc(alias = "G_LOG_LEVEL_WARNING")]
        const LEVEL_WARNING = ffi::G_LOG_LEVEL_WARNING as _;
        /// log level for messages, see `message()`
        #[doc(alias = "G_LOG_LEVEL_MESSAGE")]
        const LEVEL_MESSAGE = ffi::G_LOG_LEVEL_MESSAGE as _;
        /// log level for informational messages, see `info()`
        #[doc(alias = "G_LOG_LEVEL_INFO")]
        const LEVEL_INFO = ffi::G_LOG_LEVEL_INFO as _;
        /// log level for debug messages, see `debug()`
        #[doc(alias = "G_LOG_LEVEL_DEBUG")]
        const LEVEL_DEBUG = ffi::G_LOG_LEVEL_DEBUG as _;
        /// a mask including all log levels
        #[doc(alias = "G_LOG_LEVEL_MASK")]
        const LEVEL_MASK = ffi::G_LOG_LEVEL_MASK as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GLogLevelFlags {
        self.bits()
    }
}

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

#[cfg(feature = "v2_72")]
bitflags! {
    /// Flags to pass to `GLib::MainContext::new_with_flags()` which affect the
    /// behaviour of a [`MainContext`][crate::MainContext].
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GMainContextFlags")]
    pub struct MainContextFlags: u32 {
        /// Default behaviour.
        #[doc(alias = "G_MAIN_CONTEXT_FLAGS_NONE")]
        const NONE = ffi::G_MAIN_CONTEXT_FLAGS_NONE as _;
        /// Assume that polling for events will
        /// free the thread to process other jobs. That's useful if you're using
        /// `g_main_context_{prepare,query,check,dispatch}` to integrate GMainContext in
        /// other event loops.
        #[doc(alias = "G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING")]
        const OWNERLESS_POLLING = ffi::G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING as _;
    }
}

#[cfg(feature = "v2_72")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
#[doc(hidden)]
impl IntoGlib for MainContextFlags {
    type GlibType = ffi::GMainContextFlags;

    #[inline]
    fn into_glib(self) -> ffi::GMainContextFlags {
        self.bits()
    }
}

#[cfg(feature = "v2_72")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
#[doc(hidden)]
impl FromGlib<ffi::GMainContextFlags> for MainContextFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::GMainContextFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

bitflags! {
    /// Flags which modify individual options.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[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 _;
        /// The option doesn't appear in `--help` output.
        #[doc(alias = "G_OPTION_FLAG_HIDDEN")]
        const HIDDEN = ffi::G_OPTION_FLAG_HIDDEN as _;
        /// 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 _;
        /// For options of the [`OptionArg::None`][crate::OptionArg::None] kind, this
        ///     flag indicates that the sense of the option is reversed. i.e. [`false`] will
        ///     be stored into the argument rather than [`true`].
        #[doc(alias = "G_OPTION_FLAG_REVERSE")]
        const REVERSE = ffi::G_OPTION_FLAG_REVERSE as _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GOptionFlags {
        self.bits()
    }
}

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

bitflags! {
    /// Flags specifying compile-time options.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GRegexCompileFlags")]
    pub struct RegexCompileFlags: u32 {
        /// No special options set. Since: 2.74
        #[doc(alias = "G_REGEX_DEFAULT")]
        const DEFAULT = ffi::G_REGEX_DEFAULT as _;
        /// Letters in the pattern match both upper- and
        ///     lowercase letters. This option can be changed within a pattern
        ///     by a "(?i)" option setting.
        #[doc(alias = "G_REGEX_CASELESS")]
        const CASELESS = ffi::G_REGEX_CASELESS as _;
        /// By default, GRegex treats the strings as consisting
        ///     of a single line of characters (even if it actually contains
        ///     newlines). The "start of line" metacharacter ("^") matches only
        ///     at the start of the string, while the "end of line" metacharacter
        ///     ("$") matches only at the end of the string, or before a terminating
        ///     newline (unless [`DOLLAR_ENDONLY`][Self::DOLLAR_ENDONLY] is set). When
        ///     [`MULTILINE`][Self::MULTILINE] is set, the "start of line" and "end of line"
        ///     constructs match immediately following or immediately before any
        ///     newline in the string, respectively, as well as at the very start
        ///     and end. This can be changed within a pattern by a "(?m)" option
        ///     setting.
        #[doc(alias = "G_REGEX_MULTILINE")]
        const MULTILINE = ffi::G_REGEX_MULTILINE as _;
        /// A dot metacharacter (".") in the pattern matches all
        ///     characters, including newlines. Without it, newlines are excluded.
        ///     This option can be changed within a pattern by a ("?s") option setting.
        #[doc(alias = "G_REGEX_DOTALL")]
        const DOTALL = ffi::G_REGEX_DOTALL as _;
        /// Whitespace data characters in the pattern are
        ///     totally ignored except when escaped or inside a character class.
        ///     Whitespace does not include the VT character (code 11). In addition,
        ///     characters between an unescaped "#" outside a character class and
        ///     the next newline character, inclusive, are also ignored. This can
        ///     be changed within a pattern by a "(?x)" option setting.
        #[doc(alias = "G_REGEX_EXTENDED")]
        const EXTENDED = ffi::G_REGEX_EXTENDED as _;
        /// The pattern is forced to be "anchored", that is,
        ///     it is constrained to match only at the first matching point in the
        ///     string that is being searched. This effect can also be achieved by
        ///     appropriate constructs in the pattern itself such as the "^"
        ///     metacharacter.
        #[doc(alias = "G_REGEX_ANCHORED")]
        const ANCHORED = ffi::G_REGEX_ANCHORED as _;
        /// A dollar metacharacter ("$") in the pattern
        ///     matches only at the end of the string. Without this option, a
        ///     dollar also matches immediately before the final character if
        ///     it is a newline (but not before any other newlines). This option
        ///     is ignored if [`MULTILINE`][Self::MULTILINE] is set.
        #[doc(alias = "G_REGEX_DOLLAR_ENDONLY")]
        const DOLLAR_ENDONLY = ffi::G_REGEX_DOLLAR_ENDONLY as _;
        /// Inverts the "greediness" of the quantifiers so that
        ///     they are not greedy by default, but become greedy if followed by "?".
        ///     It can also be set by a "(?U)" option setting within the pattern.
        #[doc(alias = "G_REGEX_UNGREEDY")]
        const UNGREEDY = ffi::G_REGEX_UNGREEDY as _;
        /// Usually strings must be valid UTF-8 strings, using this
        ///     flag they are considered as a raw sequence of bytes.
        #[doc(alias = "G_REGEX_RAW")]
        const RAW = ffi::G_REGEX_RAW as _;
        /// Disables the use of numbered capturing
        ///     parentheses in the pattern. Any opening parenthesis that is not
        ///     followed by "?" behaves as if it were followed by "?:" but named
        ///     parentheses can still be used for capturing (and they acquire numbers
        ///     in the usual way).
        #[doc(alias = "G_REGEX_NO_AUTO_CAPTURE")]
        const NO_AUTO_CAPTURE = ffi::G_REGEX_NO_AUTO_CAPTURE as _;
        /// Since 2.74 and the port to pcre2, requests JIT
        ///     compilation, which, if the just-in-time compiler is available, further
        ///     processes a compiled pattern into machine code that executes much
        ///     faster. However, it comes at the cost of extra processing before the
        ///     match is performed, so it is most beneficial to use this when the same
        ///     compiled pattern is used for matching many times. Before 2.74 this
        ///     option used the built-in non-JIT optimizations in pcre1.
        #[doc(alias = "G_REGEX_OPTIMIZE")]
        const OPTIMIZE = ffi::G_REGEX_OPTIMIZE as _;
        /// Limits an unanchored pattern to match before (or at) the
        ///     first newline. Since: 2.34
        #[doc(alias = "G_REGEX_FIRSTLINE")]
        const FIRSTLINE = ffi::G_REGEX_FIRSTLINE as _;
        /// Names used to identify capturing subpatterns need not
        ///     be unique. This can be helpful for certain types of pattern when it
        ///     is known that only one instance of the named subpattern can ever be
        ///     matched.
        #[doc(alias = "G_REGEX_DUPNAMES")]
        const DUPNAMES = ffi::G_REGEX_DUPNAMES as _;
        /// Usually any newline character or character sequence is
        ///     recognized. If this option is set, the only recognized newline character
        ///     is '\r'.
        #[doc(alias = "G_REGEX_NEWLINE_CR")]
        const NEWLINE_CR = ffi::G_REGEX_NEWLINE_CR as _;
        /// Usually any newline character or character sequence is
        ///     recognized. If this option is set, the only recognized newline character
        ///     is '\n'.
        #[doc(alias = "G_REGEX_NEWLINE_LF")]
        const NEWLINE_LF = ffi::G_REGEX_NEWLINE_LF as _;
        /// Usually any newline character or character sequence is
        ///     recognized. If this option is set, the only recognized newline character
        ///     sequence is '\r\n'.
        #[doc(alias = "G_REGEX_NEWLINE_CRLF")]
        const NEWLINE_CRLF = ffi::G_REGEX_NEWLINE_CRLF as _;
        /// Usually any newline character or character sequence
        ///     is recognized. If this option is set, the only recognized newline character
        ///     sequences are '\r', '\n', and '\r\n'. Since: 2.34
        #[doc(alias = "G_REGEX_NEWLINE_ANYCRLF")]
        const NEWLINE_ANYCRLF = ffi::G_REGEX_NEWLINE_ANYCRLF as _;
        /// Usually any newline character or character sequence
        ///     is recognised. If this option is set, then "\R" only recognizes the newline
        ///    characters '\r', '\n' and '\r\n'. Since: 2.34
        #[doc(alias = "G_REGEX_BSR_ANYCRLF")]
        const BSR_ANYCRLF = ffi::G_REGEX_BSR_ANYCRLF as _;
        /// Changes behaviour so that it is compatible with
        ///     JavaScript rather than PCRE. Since GLib 2.74 this is no longer supported,
        ///     as libpcre2 does not support it. Since: 2.34 Deprecated: 2.74
        #[doc(alias = "G_REGEX_JAVASCRIPT_COMPAT")]
        const JAVASCRIPT_COMPAT = ffi::G_REGEX_JAVASCRIPT_COMPAT as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GRegexCompileFlags {
        self.bits()
    }
}

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

bitflags! {
    /// Flags specifying match-time options.
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GRegexMatchFlags")]
    pub struct RegexMatchFlags: u32 {
        /// No special options set. Since: 2.74
        #[doc(alias = "G_REGEX_MATCH_DEFAULT")]
        const DEFAULT = ffi::G_REGEX_MATCH_DEFAULT as _;
        /// The pattern is forced to be "anchored", that is,
        ///     it is constrained to match only at the first matching point in the
        ///     string that is being searched. This effect can also be achieved by
        ///     appropriate constructs in the pattern itself such as the "^"
        ///     metacharacter.
        #[doc(alias = "G_REGEX_MATCH_ANCHORED")]
        const ANCHORED = ffi::G_REGEX_MATCH_ANCHORED as _;
        /// Specifies that first character of the string is
        ///     not the beginning of a line, so the circumflex metacharacter should
        ///     not match before it. Setting this without [`RegexCompileFlags::MULTILINE`][crate::RegexCompileFlags::MULTILINE] (at
        ///     compile time) causes circumflex never to match. This option affects
        ///     only the behaviour of the circumflex metacharacter, it does not
        ///     affect "\A".
        #[doc(alias = "G_REGEX_MATCH_NOTBOL")]
        const NOTBOL = ffi::G_REGEX_MATCH_NOTBOL as _;
        /// Specifies that the end of the subject string is
        ///     not the end of a line, so the dollar metacharacter should not match
        ///     it nor (except in multiline mode) a newline immediately before it.
        ///     Setting this without [`RegexCompileFlags::MULTILINE`][crate::RegexCompileFlags::MULTILINE] (at compile time) causes
        ///     dollar never to match. This option affects only the behaviour of
        ///     the dollar metacharacter, it does not affect "\Z" or "\z".
        #[doc(alias = "G_REGEX_MATCH_NOTEOL")]
        const NOTEOL = ffi::G_REGEX_MATCH_NOTEOL as _;
        /// An empty string is not considered to be a valid
        ///     match if this option is set. If there are alternatives in the pattern,
        ///     they are tried. If all the alternatives match the empty string, the
        ///     entire match fails. For example, if the pattern "a?b?" is applied to
        ///     a string not beginning with "a" or "b", it matches the empty string
        ///     at the start of the string. With this flag set, this match is not
        ///     valid, so GRegex searches further into the string for occurrences
        ///     of "a" or "b".
        #[doc(alias = "G_REGEX_MATCH_NOTEMPTY")]
        const NOTEMPTY = ffi::G_REGEX_MATCH_NOTEMPTY as _;
        /// Turns on the partial matching feature, for more
        ///     documentation on partial matching see g_match_info_is_partial_match().
        #[doc(alias = "G_REGEX_MATCH_PARTIAL")]
        const PARTIAL = ffi::G_REGEX_MATCH_PARTIAL as _;
        /// Overrides the newline definition set when
        ///     creating a new #GRegex, setting the '\r' character as line terminator.
        #[doc(alias = "G_REGEX_MATCH_NEWLINE_CR")]
        const NEWLINE_CR = ffi::G_REGEX_MATCH_NEWLINE_CR as _;
        /// Overrides the newline definition set when
        ///     creating a new #GRegex, setting the '\n' character as line terminator.
        #[doc(alias = "G_REGEX_MATCH_NEWLINE_LF")]
        const NEWLINE_LF = ffi::G_REGEX_MATCH_NEWLINE_LF as _;
        /// Overrides the newline definition set when
        ///     creating a new #GRegex, setting the '\r\n' characters sequence as line terminator.
        #[doc(alias = "G_REGEX_MATCH_NEWLINE_CRLF")]
        const NEWLINE_CRLF = ffi::G_REGEX_MATCH_NEWLINE_CRLF as _;
        /// Overrides the newline definition set when
        ///     creating a new #GRegex, any Unicode newline sequence
        ///     is recognised as a newline. These are '\r', '\n' and '\rn', and the
        ///     single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
        ///     U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
        ///     U+2029 PARAGRAPH SEPARATOR.
        #[doc(alias = "G_REGEX_MATCH_NEWLINE_ANY")]
        const NEWLINE_ANY = ffi::G_REGEX_MATCH_NEWLINE_ANY as _;
        /// Overrides the newline definition set when
        ///     creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence
        ///     is recognized as a newline. Since: 2.34
        #[doc(alias = "G_REGEX_MATCH_NEWLINE_ANYCRLF")]
        const NEWLINE_ANYCRLF = ffi::G_REGEX_MATCH_NEWLINE_ANYCRLF as _;
        /// Overrides the newline definition for "\R" set when
        ///     creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences
        ///     are recognized as a newline by "\R". Since: 2.34
        #[doc(alias = "G_REGEX_MATCH_BSR_ANYCRLF")]
        const BSR_ANYCRLF = ffi::G_REGEX_MATCH_BSR_ANYCRLF as _;
        /// Overrides the newline definition for "\R" set when
        ///     creating a new #GRegex; any Unicode newline character or character sequence
        ///     are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the
        ///     single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
        ///     U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
        ///     U+2029 PARAGRAPH SEPARATOR. Since: 2.34
        #[doc(alias = "G_REGEX_MATCH_BSR_ANY")]
        const BSR_ANY = ffi::G_REGEX_MATCH_BSR_ANY as _;
        /// An alias for [`PARTIAL`][Self::PARTIAL]. Since: 2.34
        #[doc(alias = "G_REGEX_MATCH_PARTIAL_SOFT")]
        const PARTIAL_SOFT = ffi::G_REGEX_MATCH_PARTIAL_SOFT as _;
        /// Turns on the partial matching feature. In contrast to
        ///     to [`PARTIAL_SOFT`][Self::PARTIAL_SOFT], this stops matching as soon as a partial match
        ///     is found, without continuing to search for a possible complete match. See
        ///     g_match_info_is_partial_match() for more information. Since: 2.34
        #[doc(alias = "G_REGEX_MATCH_PARTIAL_HARD")]
        const PARTIAL_HARD = ffi::G_REGEX_MATCH_PARTIAL_HARD as _;
        /// Like [`NOTEMPTY`][Self::NOTEMPTY], but only applied to
        ///     the start of the matched string. For anchored
        ///     patterns this can only happen for pattern containing "\K". Since: 2.34
        #[doc(alias = "G_REGEX_MATCH_NOTEMPTY_ATSTART")]
        const NOTEMPTY_ATSTART = ffi::G_REGEX_MATCH_NOTEMPTY_ATSTART as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GRegexMatchFlags {
        self.bits()
    }
}

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

bitflags! {
    /// Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GSpawnFlags")]
    pub struct SpawnFlags: u32 {
        /// no flags, default behaviour
        #[doc(alias = "G_SPAWN_DEFAULT")]
        const DEFAULT = ffi::G_SPAWN_DEFAULT as _;
        /// 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 _;
        /// 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 _;
        /// `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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// The child will inherit the parent's standard output.
        #[cfg(feature = "v2_74")]
        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDOUT")]
        const CHILD_INHERITS_STDOUT = ffi::G_SPAWN_CHILD_INHERITS_STDOUT as _;
        /// The child will inherit the parent's standard error.
        #[cfg(feature = "v2_74")]
        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDERR")]
        const CHILD_INHERITS_STDERR = ffi::G_SPAWN_CHILD_INHERITS_STDERR as _;
        /// The child's standard input is attached to `/dev/null`.
        #[cfg(feature = "v2_74")]
        #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
        #[doc(alias = "G_SPAWN_STDIN_FROM_DEV_NULL")]
        const STDIN_FROM_DEV_NULL = ffi::G_SPAWN_STDIN_FROM_DEV_NULL as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GSpawnFlags {
        self.bits()
    }
}

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

#[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 g_uri_peek_scheme() on the URI string
    /// to check the scheme first, and use that to decide what flags to
    /// parse it with.
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GUriFlags")]
    pub struct UriFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_URI_FLAGS_NONE")]
        const NONE = ffi::G_URI_FLAGS_NONE as _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// 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 #GUri
        ///     should not do any encoding itself.
        #[doc(alias = "G_URI_FLAGS_ENCODED")]
        const ENCODED = ffi::G_URI_FLAGS_ENCODED as _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// 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 _;
        /// A scheme-based normalization will be applied.
        ///     For example, when parsing an HTTP URI changing omitted path to `/` and
        ///     omitted port to `80`; and when building a URI, changing empty path to `/`
        ///     and default port `80`). This only supports a subset of known schemes. (Since: 2.68)
        #[doc(alias = "G_URI_FLAGS_SCHEME_NORMALIZE")]
        const SCHEME_NORMALIZE = ffi::G_URI_FLAGS_SCHEME_NORMALIZE as _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GUriFlags {
        self.bits()
    }
}

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

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

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

    #[inline]
    fn into_glib(self) -> ffi::GUriHideFlags {
        self.bits()
    }
}

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

#[cfg(feature = "v2_66")]
bitflags! {
    /// Flags modifying the way parameters are handled by g_uri_parse_params() and
    /// #GUriParamsIter.
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GUriParamsFlags")]
    pub struct UriParamsFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_URI_PARAMS_NONE")]
        const NONE = ffi::G_URI_PARAMS_NONE as _;
        /// Parameter names are case insensitive.
        #[doc(alias = "G_URI_PARAMS_CASE_INSENSITIVE")]
        const CASE_INSENSITIVE = ffi::G_URI_PARAMS_CASE_INSENSITIVE as _;
        /// 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 _;
        /// 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 _;
    }
}

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

    #[inline]
    fn into_glib(self) -> ffi::GUriParamsFlags {
        self.bits()
    }
}

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