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
// 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, prelude::*, translate::*};
use std::fmt;

#[cfg(feature = "v2_66")]
bitflags! {
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GFileSetContentsFlags")]
    pub struct FileSetContentsFlags: u32 {
        #[doc(alias = "G_FILE_SET_CONTENTS_NONE")]
        const NONE = ffi::G_FILE_SET_CONTENTS_NONE as _;
        #[doc(alias = "G_FILE_SET_CONTENTS_CONSISTENT")]
        const CONSISTENT = ffi::G_FILE_SET_CONTENTS_CONSISTENT as _;
        #[doc(alias = "G_FILE_SET_CONTENTS_DURABLE")]
        const DURABLE = ffi::G_FILE_SET_CONTENTS_DURABLE as _;
        #[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")))]
impl fmt::Display for FileSetContentsFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GFileTest")]
    pub(crate) struct FileTest: u32 {
        #[doc(alias = "G_FILE_TEST_IS_REGULAR")]
        const IS_REGULAR = ffi::G_FILE_TEST_IS_REGULAR as _;
        #[doc(alias = "G_FILE_TEST_IS_SYMLINK")]
        const IS_SYMLINK = ffi::G_FILE_TEST_IS_SYMLINK as _;
        #[doc(alias = "G_FILE_TEST_IS_DIR")]
        const IS_DIR = ffi::G_FILE_TEST_IS_DIR as _;
        #[doc(alias = "G_FILE_TEST_IS_EXECUTABLE")]
        const IS_EXECUTABLE = ffi::G_FILE_TEST_IS_EXECUTABLE as _;
        #[doc(alias = "G_FILE_TEST_EXISTS")]
        const EXISTS = ffi::G_FILE_TEST_EXISTS as _;
    }
}

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;

    #[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GFormatSizeFlags")]
    pub struct FormatSizeFlags: u32 {
        #[doc(alias = "G_FORMAT_SIZE_DEFAULT")]
        const DEFAULT = ffi::G_FORMAT_SIZE_DEFAULT as _;
        #[doc(alias = "G_FORMAT_SIZE_LONG_FORMAT")]
        const LONG_FORMAT = ffi::G_FORMAT_SIZE_LONG_FORMAT as _;
        #[doc(alias = "G_FORMAT_SIZE_IEC_UNITS")]
        const IEC_UNITS = ffi::G_FORMAT_SIZE_IEC_UNITS as _;
        #[doc(alias = "G_FORMAT_SIZE_BITS")]
        const BITS = ffi::G_FORMAT_SIZE_BITS as _;
        #[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 _;
        #[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 _;
    }
}

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;

    #[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GIOCondition")]
    pub struct IOCondition: u32 {
        #[doc(alias = "G_IO_IN")]
        const IN = ffi::G_IO_IN as _;
        #[doc(alias = "G_IO_OUT")]
        const OUT = ffi::G_IO_OUT as _;
        #[doc(alias = "G_IO_PRI")]
        const PRI = ffi::G_IO_PRI as _;
        #[doc(alias = "G_IO_ERR")]
        const ERR = ffi::G_IO_ERR as _;
        #[doc(alias = "G_IO_HUP")]
        const HUP = ffi::G_IO_HUP as _;
        #[doc(alias = "G_IO_NVAL")]
        const NVAL = ffi::G_IO_NVAL as _;
    }
}

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;

    #[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GKeyFileFlags")]
    pub struct KeyFileFlags: u32 {
        #[doc(alias = "G_KEY_FILE_NONE")]
        const NONE = ffi::G_KEY_FILE_NONE as _;
        #[doc(alias = "G_KEY_FILE_KEEP_COMMENTS")]
        const KEEP_COMMENTS = ffi::G_KEY_FILE_KEEP_COMMENTS as _;
        #[doc(alias = "G_KEY_FILE_KEEP_TRANSLATIONS")]
        const KEEP_TRANSLATIONS = ffi::G_KEY_FILE_KEEP_TRANSLATIONS as _;
    }
}

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;

    #[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GLogLevelFlags")]
    pub struct LogLevelFlags: u32 {
        #[doc(alias = "G_LOG_FLAG_RECURSION")]
        const FLAG_RECURSION = ffi::G_LOG_FLAG_RECURSION as _;
        #[doc(alias = "G_LOG_FLAG_FATAL")]
        const FLAG_FATAL = ffi::G_LOG_FLAG_FATAL as _;
        #[doc(alias = "G_LOG_LEVEL_ERROR")]
        const LEVEL_ERROR = ffi::G_LOG_LEVEL_ERROR as _;
        #[doc(alias = "G_LOG_LEVEL_CRITICAL")]
        const LEVEL_CRITICAL = ffi::G_LOG_LEVEL_CRITICAL as _;
        #[doc(alias = "G_LOG_LEVEL_WARNING")]
        const LEVEL_WARNING = ffi::G_LOG_LEVEL_WARNING as _;
        #[doc(alias = "G_LOG_LEVEL_MESSAGE")]
        const LEVEL_MESSAGE = ffi::G_LOG_LEVEL_MESSAGE as _;
        #[doc(alias = "G_LOG_LEVEL_INFO")]
        const LEVEL_INFO = ffi::G_LOG_LEVEL_INFO as _;
        #[doc(alias = "G_LOG_LEVEL_DEBUG")]
        const LEVEL_DEBUG = ffi::G_LOG_LEVEL_DEBUG as _;
        #[doc(alias = "G_LOG_LEVEL_MASK")]
        const LEVEL_MASK = ffi::G_LOG_LEVEL_MASK as _;
    }
}

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;

    #[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! {
    #[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GMainContextFlags")]
    pub struct MainContextFlags: u32 {
        #[doc(alias = "G_MAIN_CONTEXT_FLAGS_NONE")]
        const NONE = ffi::G_MAIN_CONTEXT_FLAGS_NONE as _;
        #[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")))]
impl fmt::Display for MainContextFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GOptionFlags")]
    pub struct OptionFlags: u32 {
        #[doc(alias = "G_OPTION_FLAG_NONE")]
        const NONE = ffi::G_OPTION_FLAG_NONE as _;
        #[doc(alias = "G_OPTION_FLAG_HIDDEN")]
        const HIDDEN = ffi::G_OPTION_FLAG_HIDDEN as _;
        #[doc(alias = "G_OPTION_FLAG_IN_MAIN")]
        const IN_MAIN = ffi::G_OPTION_FLAG_IN_MAIN as _;
        #[doc(alias = "G_OPTION_FLAG_REVERSE")]
        const REVERSE = ffi::G_OPTION_FLAG_REVERSE as _;
        #[doc(alias = "G_OPTION_FLAG_NO_ARG")]
        const NO_ARG = ffi::G_OPTION_FLAG_NO_ARG as _;
        #[doc(alias = "G_OPTION_FLAG_FILENAME")]
        const FILENAME = ffi::G_OPTION_FLAG_FILENAME as _;
        #[doc(alias = "G_OPTION_FLAG_OPTIONAL_ARG")]
        const OPTIONAL_ARG = ffi::G_OPTION_FLAG_OPTIONAL_ARG as _;
        #[doc(alias = "G_OPTION_FLAG_NOALIAS")]
        const NOALIAS = ffi::G_OPTION_FLAG_NOALIAS as _;
    }
}

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;

    #[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! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GSpawnFlags")]
    pub struct SpawnFlags: u32 {
        #[doc(alias = "G_SPAWN_DEFAULT")]
        const DEFAULT = ffi::G_SPAWN_DEFAULT as _;
        #[doc(alias = "G_SPAWN_LEAVE_DESCRIPTORS_OPEN")]
        const LEAVE_DESCRIPTORS_OPEN = ffi::G_SPAWN_LEAVE_DESCRIPTORS_OPEN as _;
        #[doc(alias = "G_SPAWN_DO_NOT_REAP_CHILD")]
        const DO_NOT_REAP_CHILD = ffi::G_SPAWN_DO_NOT_REAP_CHILD as _;
        #[doc(alias = "G_SPAWN_SEARCH_PATH")]
        const SEARCH_PATH = ffi::G_SPAWN_SEARCH_PATH as _;
        #[doc(alias = "G_SPAWN_STDOUT_TO_DEV_NULL")]
        const STDOUT_TO_DEV_NULL = ffi::G_SPAWN_STDOUT_TO_DEV_NULL as _;
        #[doc(alias = "G_SPAWN_STDERR_TO_DEV_NULL")]
        const STDERR_TO_DEV_NULL = ffi::G_SPAWN_STDERR_TO_DEV_NULL as _;
        #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDIN")]
        const CHILD_INHERITS_STDIN = ffi::G_SPAWN_CHILD_INHERITS_STDIN as _;
        #[doc(alias = "G_SPAWN_FILE_AND_ARGV_ZERO")]
        const FILE_AND_ARGV_ZERO = ffi::G_SPAWN_FILE_AND_ARGV_ZERO as _;
        #[doc(alias = "G_SPAWN_SEARCH_PATH_FROM_ENVP")]
        const SEARCH_PATH_FROM_ENVP = ffi::G_SPAWN_SEARCH_PATH_FROM_ENVP as _;
        #[doc(alias = "G_SPAWN_CLOEXEC_PIPES")]
        const CLOEXEC_PIPES = ffi::G_SPAWN_CLOEXEC_PIPES as _;
        #[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 _;
        #[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 _;
        #[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 _;
    }
}

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;

    #[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 [`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.
    #[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 [`Uri`][crate::Uri]
        ///  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")))]
impl fmt::Display for UriFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[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
    /// [`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.
    #[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")))]
impl fmt::Display for UriHideFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[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")))]
impl fmt::Display for UriParamsFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[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)
    }
}