glib/auto/flags.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{bitflags::bitflags, ffi, prelude::*, translate::*};
6
7#[cfg(feature = "v2_66")]
8bitflags! {
9 /// Flags to pass to g_file_set_contents_full() to affect its safety and
10 /// performance.
11 // rustdoc-stripper-ignore-next-stop
12 /// Flags to pass to g_file_set_contents_full() to affect its safety and
13 /// performance.
14 #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
15 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
16 #[doc(alias = "GFileSetContentsFlags")]
17 pub struct FileSetContentsFlags: u32 {
18 /// No guarantees about file consistency or durability.
19 /// The most dangerous setting, which is slightly faster than other settings.
20 // rustdoc-stripper-ignore-next-stop
21 /// No guarantees about file consistency or durability.
22 /// The most dangerous setting, which is slightly faster than other settings.
23 #[doc(alias = "G_FILE_SET_CONTENTS_NONE")]
24 const NONE = ffi::G_FILE_SET_CONTENTS_NONE as _;
25 /// Guarantee file consistency: after a crash,
26 /// either the old version of the file or the new version of the file will be
27 /// available, but not a mixture. On Unix systems this equates to an `fsync()`
28 /// on the file and use of an atomic `rename()` of the new version of the file
29 /// over the old.
30 // rustdoc-stripper-ignore-next-stop
31 /// Guarantee file consistency: after a crash,
32 /// either the old version of the file or the new version of the file will be
33 /// available, but not a mixture. On Unix systems this equates to an `fsync()`
34 /// on the file and use of an atomic `rename()` of the new version of the file
35 /// over the old.
36 #[doc(alias = "G_FILE_SET_CONTENTS_CONSISTENT")]
37 const CONSISTENT = ffi::G_FILE_SET_CONTENTS_CONSISTENT as _;
38 /// Guarantee file durability: after a crash, the
39 /// new version of the file will be available. On Unix systems this equates to
40 /// an `fsync()` on the file (if [`CONSISTENT`][Self::CONSISTENT] is unset), or
41 /// the effects of [`CONSISTENT`][Self::CONSISTENT] plus an `fsync()` on the
42 /// directory containing the file after calling `rename()`.
43 // rustdoc-stripper-ignore-next-stop
44 /// Guarantee file durability: after a crash, the
45 /// new version of the file will be available. On Unix systems this equates to
46 /// an `fsync()` on the file (if [`CONSISTENT`][Self::CONSISTENT] is unset), or
47 /// the effects of [`CONSISTENT`][Self::CONSISTENT] plus an `fsync()` on the
48 /// directory containing the file after calling `rename()`.
49 #[doc(alias = "G_FILE_SET_CONTENTS_DURABLE")]
50 const DURABLE = ffi::G_FILE_SET_CONTENTS_DURABLE as _;
51 /// Only apply consistency and durability
52 /// guarantees if the file already exists. This may speed up file operations
53 /// if the file doesn’t currently exist, but may result in a corrupted version
54 /// of the new file if the system crashes while writing it.
55 // rustdoc-stripper-ignore-next-stop
56 /// Only apply consistency and durability
57 /// guarantees if the file already exists. This may speed up file operations
58 /// if the file doesn’t currently exist, but may result in a corrupted version
59 /// of the new file if the system crashes while writing it.
60 #[doc(alias = "G_FILE_SET_CONTENTS_ONLY_EXISTING")]
61 const ONLY_EXISTING = ffi::G_FILE_SET_CONTENTS_ONLY_EXISTING as _;
62 }
63}
64
65#[cfg(feature = "v2_66")]
66#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
67#[doc(hidden)]
68impl IntoGlib for FileSetContentsFlags {
69 type GlibType = ffi::GFileSetContentsFlags;
70
71 #[inline]
72 fn into_glib(self) -> ffi::GFileSetContentsFlags {
73 self.bits()
74 }
75}
76
77#[cfg(feature = "v2_66")]
78#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
79#[doc(hidden)]
80impl FromGlib<ffi::GFileSetContentsFlags> for FileSetContentsFlags {
81 #[inline]
82 unsafe fn from_glib(value: ffi::GFileSetContentsFlags) -> Self {
83 Self::from_bits_truncate(value)
84 }
85}
86
87bitflags! {
88 /// A test to perform on a file using g_file_test().
89 // rustdoc-stripper-ignore-next-stop
90 /// A test to perform on a file using g_file_test().
91 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
92 #[doc(alias = "GFileTest")]
93 pub(crate) struct FileTest: u32 {
94 /// [`true`] if the file is a regular file
95 /// (not a directory). Note that this test will also return [`true`]
96 /// if the tested file is a symlink to a regular file.
97 // rustdoc-stripper-ignore-next-stop
98 /// [`true`] if the file is a regular file
99 /// (not a directory). Note that this test will also return [`true`]
100 /// if the tested file is a symlink to a regular file.
101 #[doc(alias = "G_FILE_TEST_IS_REGULAR")]
102 const IS_REGULAR = ffi::G_FILE_TEST_IS_REGULAR as _;
103 /// [`true`] if the file is a symlink.
104 // rustdoc-stripper-ignore-next-stop
105 /// [`true`] if the file is a symlink.
106 #[doc(alias = "G_FILE_TEST_IS_SYMLINK")]
107 const IS_SYMLINK = ffi::G_FILE_TEST_IS_SYMLINK as _;
108 /// [`true`] if the file is a directory.
109 // rustdoc-stripper-ignore-next-stop
110 /// [`true`] if the file is a directory.
111 #[doc(alias = "G_FILE_TEST_IS_DIR")]
112 const IS_DIR = ffi::G_FILE_TEST_IS_DIR as _;
113 /// [`true`] if the file is executable.
114 // rustdoc-stripper-ignore-next-stop
115 /// [`true`] if the file is executable.
116 #[doc(alias = "G_FILE_TEST_IS_EXECUTABLE")]
117 const IS_EXECUTABLE = ffi::G_FILE_TEST_IS_EXECUTABLE as _;
118 /// [`true`] if the file exists. It may or may not
119 /// be a regular file.
120 // rustdoc-stripper-ignore-next-stop
121 /// [`true`] if the file exists. It may or may not
122 /// be a regular file.
123 #[doc(alias = "G_FILE_TEST_EXISTS")]
124 const EXISTS = ffi::G_FILE_TEST_EXISTS as _;
125 }
126}
127
128#[doc(hidden)]
129impl IntoGlib for FileTest {
130 type GlibType = ffi::GFileTest;
131
132 #[inline]
133 fn into_glib(self) -> ffi::GFileTest {
134 self.bits()
135 }
136}
137
138#[doc(hidden)]
139impl FromGlib<ffi::GFileTest> for FileTest {
140 #[inline]
141 unsafe fn from_glib(value: ffi::GFileTest) -> Self {
142 Self::from_bits_truncate(value)
143 }
144}
145
146bitflags! {
147 /// Flags to modify the format of the string returned by g_format_size_full().
148 // rustdoc-stripper-ignore-next-stop
149 /// Flags to modify the format of the string returned by g_format_size_full().
150 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
151 #[doc(alias = "GFormatSizeFlags")]
152 pub struct FormatSizeFlags: u32 {
153 /// behave the same as g_format_size()
154 // rustdoc-stripper-ignore-next-stop
155 /// behave the same as g_format_size()
156 #[doc(alias = "G_FORMAT_SIZE_DEFAULT")]
157 const DEFAULT = ffi::G_FORMAT_SIZE_DEFAULT as _;
158 /// include the exact number of bytes as part
159 /// of the returned string. For example, "45.6 kB (45,612 bytes)".
160 // rustdoc-stripper-ignore-next-stop
161 /// include the exact number of bytes as part
162 /// of the returned string. For example, "45.6 kB (45,612 bytes)".
163 #[doc(alias = "G_FORMAT_SIZE_LONG_FORMAT")]
164 const LONG_FORMAT = ffi::G_FORMAT_SIZE_LONG_FORMAT as _;
165 /// use IEC (base 1024) units with "KiB"-style
166 /// suffixes. IEC units should only be used for reporting things with
167 /// a strong "power of 2" basis, like RAM sizes or RAID stripe sizes.
168 /// Network and storage sizes should be reported in the normal SI units.
169 // rustdoc-stripper-ignore-next-stop
170 /// use IEC (base 1024) units with "KiB"-style
171 /// suffixes. IEC units should only be used for reporting things with
172 /// a strong "power of 2" basis, like RAM sizes or RAID stripe sizes.
173 /// Network and storage sizes should be reported in the normal SI units.
174 #[doc(alias = "G_FORMAT_SIZE_IEC_UNITS")]
175 const IEC_UNITS = ffi::G_FORMAT_SIZE_IEC_UNITS as _;
176 /// set the size as a quantity in bits, rather than
177 /// bytes, and return units in bits. For example, ‘Mbit’ rather than ‘MB’.
178 // rustdoc-stripper-ignore-next-stop
179 /// set the size as a quantity in bits, rather than
180 /// bytes, and return units in bits. For example, ‘Mbit’ rather than ‘MB’.
181 #[doc(alias = "G_FORMAT_SIZE_BITS")]
182 const BITS = ffi::G_FORMAT_SIZE_BITS as _;
183 /// return only value, without unit; this should
184 /// not be used together with @G_FORMAT_SIZE_LONG_FORMAT
185 /// nor @G_FORMAT_SIZE_ONLY_UNIT. Since: 2.74
186 // rustdoc-stripper-ignore-next-stop
187 /// return only value, without unit; this should
188 /// not be used together with @G_FORMAT_SIZE_LONG_FORMAT
189 /// nor @G_FORMAT_SIZE_ONLY_UNIT. Since: 2.74
190 #[cfg(feature = "v2_74")]
191 #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
192 #[doc(alias = "G_FORMAT_SIZE_ONLY_VALUE")]
193 const ONLY_VALUE = ffi::G_FORMAT_SIZE_ONLY_VALUE as _;
194 /// return only unit, without value; this should
195 /// not be used together with @G_FORMAT_SIZE_LONG_FORMAT
196 /// nor @G_FORMAT_SIZE_ONLY_VALUE. Since: 2.74
197 // rustdoc-stripper-ignore-next-stop
198 /// return only unit, without value; this should
199 /// not be used together with @G_FORMAT_SIZE_LONG_FORMAT
200 /// nor @G_FORMAT_SIZE_ONLY_VALUE. Since: 2.74
201 #[cfg(feature = "v2_74")]
202 #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
203 #[doc(alias = "G_FORMAT_SIZE_ONLY_UNIT")]
204 const ONLY_UNIT = ffi::G_FORMAT_SIZE_ONLY_UNIT as _;
205 }
206}
207
208#[doc(hidden)]
209impl IntoGlib for FormatSizeFlags {
210 type GlibType = ffi::GFormatSizeFlags;
211
212 #[inline]
213 fn into_glib(self) -> ffi::GFormatSizeFlags {
214 self.bits()
215 }
216}
217
218#[doc(hidden)]
219impl FromGlib<ffi::GFormatSizeFlags> for FormatSizeFlags {
220 #[inline]
221 unsafe fn from_glib(value: ffi::GFormatSizeFlags) -> Self {
222 Self::from_bits_truncate(value)
223 }
224}
225
226bitflags! {
227 /// A bitwise combination representing a condition to watch for on an
228 /// event source.
229 // rustdoc-stripper-ignore-next-stop
230 /// A bitwise combination representing a condition to watch for on an
231 /// event source.
232 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
233 #[doc(alias = "GIOCondition")]
234 pub struct IOCondition: u32 {
235 /// There is data to read.
236 // rustdoc-stripper-ignore-next-stop
237 /// There is data to read.
238 #[doc(alias = "G_IO_IN")]
239 const IN = ffi::G_IO_IN as _;
240 /// Data can be written (without blocking).
241 // rustdoc-stripper-ignore-next-stop
242 /// Data can be written (without blocking).
243 #[doc(alias = "G_IO_OUT")]
244 const OUT = ffi::G_IO_OUT as _;
245 /// There is urgent data to read.
246 // rustdoc-stripper-ignore-next-stop
247 /// There is urgent data to read.
248 #[doc(alias = "G_IO_PRI")]
249 const PRI = ffi::G_IO_PRI as _;
250 /// Error condition.
251 // rustdoc-stripper-ignore-next-stop
252 /// Error condition.
253 #[doc(alias = "G_IO_ERR")]
254 const ERR = ffi::G_IO_ERR as _;
255 /// Hung up (the connection has been broken, usually for
256 /// pipes and sockets).
257 // rustdoc-stripper-ignore-next-stop
258 /// Hung up (the connection has been broken, usually for
259 /// pipes and sockets).
260 #[doc(alias = "G_IO_HUP")]
261 const HUP = ffi::G_IO_HUP as _;
262 /// Invalid request. The file descriptor is not open.
263 // rustdoc-stripper-ignore-next-stop
264 /// Invalid request. The file descriptor is not open.
265 #[doc(alias = "G_IO_NVAL")]
266 const NVAL = ffi::G_IO_NVAL as _;
267 }
268}
269
270#[doc(hidden)]
271impl IntoGlib for IOCondition {
272 type GlibType = ffi::GIOCondition;
273
274 #[inline]
275 fn into_glib(self) -> ffi::GIOCondition {
276 self.bits()
277 }
278}
279
280#[doc(hidden)]
281impl FromGlib<ffi::GIOCondition> for IOCondition {
282 #[inline]
283 unsafe fn from_glib(value: ffi::GIOCondition) -> Self {
284 Self::from_bits_truncate(value)
285 }
286}
287
288impl StaticType for IOCondition {
289 #[inline]
290 #[doc(alias = "g_io_condition_get_type")]
291 fn static_type() -> crate::Type {
292 unsafe { from_glib(ffi::g_io_condition_get_type()) }
293 }
294}
295
296impl crate::HasParamSpec for IOCondition {
297 type ParamSpec = crate::ParamSpecFlags;
298 type SetValue = Self;
299 type BuilderFn = fn(&str) -> crate::ParamSpecFlagsBuilder<Self>;
300
301 fn param_spec_builder() -> Self::BuilderFn {
302 Self::ParamSpec::builder
303 }
304}
305
306impl crate::value::ValueType for IOCondition {
307 type Type = Self;
308}
309
310unsafe impl<'a> crate::value::FromValue<'a> for IOCondition {
311 type Checker = crate::value::GenericValueTypeChecker<Self>;
312
313 #[inline]
314 unsafe fn from_value(value: &'a crate::Value) -> Self {
315 from_glib(crate::gobject_ffi::g_value_get_flags(
316 value.to_glib_none().0,
317 ))
318 }
319}
320
321impl ToValue for IOCondition {
322 #[inline]
323 fn to_value(&self) -> crate::Value {
324 let mut value = crate::Value::for_value_type::<Self>();
325 unsafe {
326 crate::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
327 }
328 value
329 }
330
331 #[inline]
332 fn value_type(&self) -> crate::Type {
333 Self::static_type()
334 }
335}
336
337impl From<IOCondition> for crate::Value {
338 #[inline]
339 fn from(v: IOCondition) -> Self {
340 ToValue::to_value(&v)
341 }
342}
343
344bitflags! {
345 /// Flags which influence the parsing.
346 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
347 #[doc(alias = "GKeyFileFlags")]
348 pub struct KeyFileFlags: u32 {
349 /// No flags, default behaviour
350 #[doc(alias = "G_KEY_FILE_NONE")]
351 const NONE = ffi::G_KEY_FILE_NONE as _;
352 /// Use this flag if you plan to write the
353 /// (possibly modified) contents of the key file back to a file;
354 /// otherwise all comments will be lost when the key file is
355 /// written back.
356 #[doc(alias = "G_KEY_FILE_KEEP_COMMENTS")]
357 const KEEP_COMMENTS = ffi::G_KEY_FILE_KEEP_COMMENTS as _;
358 /// Use this flag if you plan to write the
359 /// (possibly modified) contents of the key file back to a file;
360 /// otherwise only the translations for the current language will be
361 /// written back.
362 #[doc(alias = "G_KEY_FILE_KEEP_TRANSLATIONS")]
363 const KEEP_TRANSLATIONS = ffi::G_KEY_FILE_KEEP_TRANSLATIONS as _;
364 }
365}
366
367#[doc(hidden)]
368impl IntoGlib for KeyFileFlags {
369 type GlibType = ffi::GKeyFileFlags;
370
371 #[inline]
372 fn into_glib(self) -> ffi::GKeyFileFlags {
373 self.bits()
374 }
375}
376
377#[doc(hidden)]
378impl FromGlib<ffi::GKeyFileFlags> for KeyFileFlags {
379 #[inline]
380 unsafe fn from_glib(value: ffi::GKeyFileFlags) -> Self {
381 Self::from_bits_truncate(value)
382 }
383}
384
385bitflags! {
386 /// Flags specifying the level of log messages.
387 ///
388 /// It is possible to change how GLib treats messages of the various
389 /// levels using `log_set_handler()` and `log_set_fatal_mask()`.
390 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
391 #[doc(alias = "GLogLevelFlags")]
392 pub struct LogLevelFlags: u32 {
393 /// internal flag
394 #[doc(alias = "G_LOG_FLAG_RECURSION")]
395 const FLAG_RECURSION = ffi::G_LOG_FLAG_RECURSION as _;
396 /// internal flag
397 #[doc(alias = "G_LOG_FLAG_FATAL")]
398 const FLAG_FATAL = ffi::G_LOG_FLAG_FATAL as _;
399 /// log level for errors, see `error()`.
400 /// This level is also used for messages produced by `assert()`.
401 #[doc(alias = "G_LOG_LEVEL_ERROR")]
402 const LEVEL_ERROR = ffi::G_LOG_LEVEL_ERROR as _;
403 /// log level for critical warning messages, see
404 /// `critical()`. This level is also used for messages produced by
405 /// `return_if_fail()` and `return_val_if_fail()`.
406 #[doc(alias = "G_LOG_LEVEL_CRITICAL")]
407 const LEVEL_CRITICAL = ffi::G_LOG_LEVEL_CRITICAL as _;
408 /// log level for warnings, see `warning()`
409 #[doc(alias = "G_LOG_LEVEL_WARNING")]
410 const LEVEL_WARNING = ffi::G_LOG_LEVEL_WARNING as _;
411 /// log level for messages, see `message()`
412 #[doc(alias = "G_LOG_LEVEL_MESSAGE")]
413 const LEVEL_MESSAGE = ffi::G_LOG_LEVEL_MESSAGE as _;
414 /// log level for informational messages, see `info()`
415 #[doc(alias = "G_LOG_LEVEL_INFO")]
416 const LEVEL_INFO = ffi::G_LOG_LEVEL_INFO as _;
417 /// log level for debug messages, see `debug()`
418 #[doc(alias = "G_LOG_LEVEL_DEBUG")]
419 const LEVEL_DEBUG = ffi::G_LOG_LEVEL_DEBUG as _;
420 /// a mask including all log levels
421 #[doc(alias = "G_LOG_LEVEL_MASK")]
422 const LEVEL_MASK = ffi::G_LOG_LEVEL_MASK as _;
423 }
424}
425
426#[doc(hidden)]
427impl IntoGlib for LogLevelFlags {
428 type GlibType = ffi::GLogLevelFlags;
429
430 #[inline]
431 fn into_glib(self) -> ffi::GLogLevelFlags {
432 self.bits()
433 }
434}
435
436#[doc(hidden)]
437impl FromGlib<ffi::GLogLevelFlags> for LogLevelFlags {
438 #[inline]
439 unsafe fn from_glib(value: ffi::GLogLevelFlags) -> Self {
440 Self::from_bits_truncate(value)
441 }
442}
443
444#[cfg(feature = "v2_72")]
445bitflags! {
446 /// Flags to pass to `GLib::MainContext::new_with_flags()` which affect the
447 /// behaviour of a [`MainContext`][crate::MainContext].
448 #[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
449 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
450 #[doc(alias = "GMainContextFlags")]
451 pub struct MainContextFlags: u32 {
452 /// Default behaviour.
453 #[doc(alias = "G_MAIN_CONTEXT_FLAGS_NONE")]
454 const NONE = ffi::G_MAIN_CONTEXT_FLAGS_NONE as _;
455 /// Assume that polling for events will
456 /// free the thread to process other jobs. That's useful if you're using
457 /// `g_main_context_{prepare,query,check,dispatch}` to integrate GMainContext in
458 /// other event loops.
459 #[doc(alias = "G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING")]
460 const OWNERLESS_POLLING = ffi::G_MAIN_CONTEXT_FLAGS_OWNERLESS_POLLING as _;
461 }
462}
463
464#[cfg(feature = "v2_72")]
465#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
466#[doc(hidden)]
467impl IntoGlib for MainContextFlags {
468 type GlibType = ffi::GMainContextFlags;
469
470 #[inline]
471 fn into_glib(self) -> ffi::GMainContextFlags {
472 self.bits()
473 }
474}
475
476#[cfg(feature = "v2_72")]
477#[cfg_attr(docsrs, doc(cfg(feature = "v2_72")))]
478#[doc(hidden)]
479impl FromGlib<ffi::GMainContextFlags> for MainContextFlags {
480 #[inline]
481 unsafe fn from_glib(value: ffi::GMainContextFlags) -> Self {
482 Self::from_bits_truncate(value)
483 }
484}
485
486bitflags! {
487 /// Flags which modify individual options.
488 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
489 #[doc(alias = "GOptionFlags")]
490 pub struct OptionFlags: u32 {
491 /// No flags.
492 #[doc(alias = "G_OPTION_FLAG_NONE")]
493 const NONE = ffi::G_OPTION_FLAG_NONE as _;
494 /// The option doesn't appear in `--help` output.
495 #[doc(alias = "G_OPTION_FLAG_HIDDEN")]
496 const HIDDEN = ffi::G_OPTION_FLAG_HIDDEN as _;
497 /// The option appears in the main section of the
498 /// `--help` output, even if it is defined in a group.
499 #[doc(alias = "G_OPTION_FLAG_IN_MAIN")]
500 const IN_MAIN = ffi::G_OPTION_FLAG_IN_MAIN as _;
501 /// For options of the [`OptionArg::None`][crate::OptionArg::None] kind, this
502 /// flag indicates that the sense of the option is reversed. i.e. [`false`] will
503 /// be stored into the argument rather than [`true`].
504 #[doc(alias = "G_OPTION_FLAG_REVERSE")]
505 const REVERSE = ffi::G_OPTION_FLAG_REVERSE as _;
506 /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback] kind,
507 /// this flag indicates that the callback does not take any argument
508 /// (like a [`OptionArg::None`][crate::OptionArg::None] option). Since 2.8
509 #[doc(alias = "G_OPTION_FLAG_NO_ARG")]
510 const NO_ARG = ffi::G_OPTION_FLAG_NO_ARG as _;
511 /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback]
512 /// kind, this flag indicates that the argument should be passed to the
513 /// callback in the GLib filename encoding rather than UTF-8. Since 2.8
514 #[doc(alias = "G_OPTION_FLAG_FILENAME")]
515 const FILENAME = ffi::G_OPTION_FLAG_FILENAME as _;
516 /// For options of the [`OptionArg::Callback`][crate::OptionArg::Callback]
517 /// kind, this flag indicates that the argument supply is optional.
518 /// If no argument is given then data of `GOptionParseFunc` will be
519 /// set to NULL. Since 2.8
520 #[doc(alias = "G_OPTION_FLAG_OPTIONAL_ARG")]
521 const OPTIONAL_ARG = ffi::G_OPTION_FLAG_OPTIONAL_ARG as _;
522 /// This flag turns off the automatic conflict
523 /// resolution which prefixes long option names with `groupname-` if
524 /// there is a conflict. This option should only be used in situations
525 /// where aliasing is necessary to model some legacy commandline interface.
526 /// It is not safe to use this option, unless all option groups are under
527 /// your direct control. Since 2.8.
528 #[doc(alias = "G_OPTION_FLAG_NOALIAS")]
529 const NOALIAS = ffi::G_OPTION_FLAG_NOALIAS as _;
530 /// This flag marks the option as deprecated in the `--help`.
531 ///
532 /// You should update the description of the option to describe what
533 /// the user should do in response to the deprecation, for instance:
534 /// remove the option, or replace it with another one.
535 #[cfg(feature = "v2_84")]
536 #[cfg_attr(docsrs, doc(cfg(feature = "v2_84")))]
537 #[doc(alias = "G_OPTION_FLAG_DEPRECATED")]
538 const DEPRECATED = ffi::G_OPTION_FLAG_DEPRECATED as _;
539 }
540}
541
542#[doc(hidden)]
543impl IntoGlib for OptionFlags {
544 type GlibType = ffi::GOptionFlags;
545
546 #[inline]
547 fn into_glib(self) -> ffi::GOptionFlags {
548 self.bits()
549 }
550}
551
552#[doc(hidden)]
553impl FromGlib<ffi::GOptionFlags> for OptionFlags {
554 #[inline]
555 unsafe fn from_glib(value: ffi::GOptionFlags) -> Self {
556 Self::from_bits_truncate(value)
557 }
558}
559
560bitflags! {
561 /// Flags specifying compile-time options.
562 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
563 #[doc(alias = "GRegexCompileFlags")]
564 pub struct RegexCompileFlags: u32 {
565 /// No special options set. Since: 2.74
566 #[doc(alias = "G_REGEX_DEFAULT")]
567 const DEFAULT = ffi::G_REGEX_DEFAULT as _;
568 /// Letters in the pattern match both upper- and
569 /// lowercase letters. This option can be changed within a pattern
570 /// by a "(?i)" option setting.
571 #[doc(alias = "G_REGEX_CASELESS")]
572 const CASELESS = ffi::G_REGEX_CASELESS as _;
573 /// By default, GRegex treats the strings as consisting
574 /// of a single line of characters (even if it actually contains
575 /// newlines). The "start of line" metacharacter ("^") matches only
576 /// at the start of the string, while the "end of line" metacharacter
577 /// ("$") matches only at the end of the string, or before a terminating
578 /// newline (unless [`DOLLAR_ENDONLY`][Self::DOLLAR_ENDONLY] is set). When
579 /// [`MULTILINE`][Self::MULTILINE] is set, the "start of line" and "end of line"
580 /// constructs match immediately following or immediately before any
581 /// newline in the string, respectively, as well as at the very start
582 /// and end. This can be changed within a pattern by a "(?m)" option
583 /// setting.
584 #[doc(alias = "G_REGEX_MULTILINE")]
585 const MULTILINE = ffi::G_REGEX_MULTILINE as _;
586 /// A dot metacharacter (".") in the pattern matches all
587 /// characters, including newlines. Without it, newlines are excluded.
588 /// This option can be changed within a pattern by a ("?s") option setting.
589 #[doc(alias = "G_REGEX_DOTALL")]
590 const DOTALL = ffi::G_REGEX_DOTALL as _;
591 /// Whitespace data characters in the pattern are
592 /// totally ignored except when escaped or inside a character class.
593 /// Whitespace does not include the VT character (code 11). In addition,
594 /// characters between an unescaped "#" outside a character class and
595 /// the next newline character, inclusive, are also ignored. This can
596 /// be changed within a pattern by a "(?x)" option setting.
597 #[doc(alias = "G_REGEX_EXTENDED")]
598 const EXTENDED = ffi::G_REGEX_EXTENDED as _;
599 /// The pattern is forced to be "anchored", that is,
600 /// it is constrained to match only at the first matching point in the
601 /// string that is being searched. This effect can also be achieved by
602 /// appropriate constructs in the pattern itself such as the "^"
603 /// metacharacter.
604 #[doc(alias = "G_REGEX_ANCHORED")]
605 const ANCHORED = ffi::G_REGEX_ANCHORED as _;
606 /// A dollar metacharacter ("$") in the pattern
607 /// matches only at the end of the string. Without this option, a
608 /// dollar also matches immediately before the final character if
609 /// it is a newline (but not before any other newlines). This option
610 /// is ignored if [`MULTILINE`][Self::MULTILINE] is set.
611 #[doc(alias = "G_REGEX_DOLLAR_ENDONLY")]
612 const DOLLAR_ENDONLY = ffi::G_REGEX_DOLLAR_ENDONLY as _;
613 /// Inverts the "greediness" of the quantifiers so that
614 /// they are not greedy by default, but become greedy if followed by "?".
615 /// It can also be set by a "(?U)" option setting within the pattern.
616 #[doc(alias = "G_REGEX_UNGREEDY")]
617 const UNGREEDY = ffi::G_REGEX_UNGREEDY as _;
618 /// Usually strings must be valid UTF-8 strings, using this
619 /// flag they are considered as a raw sequence of bytes.
620 #[doc(alias = "G_REGEX_RAW")]
621 const RAW = ffi::G_REGEX_RAW as _;
622 /// Disables the use of numbered capturing
623 /// parentheses in the pattern. Any opening parenthesis that is not
624 /// followed by "?" behaves as if it were followed by "?:" but named
625 /// parentheses can still be used for capturing (and they acquire numbers
626 /// in the usual way).
627 #[doc(alias = "G_REGEX_NO_AUTO_CAPTURE")]
628 const NO_AUTO_CAPTURE = ffi::G_REGEX_NO_AUTO_CAPTURE as _;
629 /// Since 2.74 and the port to pcre2, requests JIT
630 /// compilation, which, if the just-in-time compiler is available, further
631 /// processes a compiled pattern into machine code that executes much
632 /// faster. However, it comes at the cost of extra processing before the
633 /// match is performed, so it is most beneficial to use this when the same
634 /// compiled pattern is used for matching many times. Before 2.74 this
635 /// option used the built-in non-JIT optimizations in pcre1.
636 #[doc(alias = "G_REGEX_OPTIMIZE")]
637 const OPTIMIZE = ffi::G_REGEX_OPTIMIZE as _;
638 /// Limits an unanchored pattern to match before (or at) the
639 /// first newline. Since: 2.34
640 #[doc(alias = "G_REGEX_FIRSTLINE")]
641 const FIRSTLINE = ffi::G_REGEX_FIRSTLINE as _;
642 /// Names used to identify capturing subpatterns need not
643 /// be unique. This can be helpful for certain types of pattern when it
644 /// is known that only one instance of the named subpattern can ever be
645 /// matched.
646 #[doc(alias = "G_REGEX_DUPNAMES")]
647 const DUPNAMES = ffi::G_REGEX_DUPNAMES as _;
648 /// Usually any newline character or character sequence is
649 /// recognized. If this option is set, the only recognized newline character
650 /// is '\r'.
651 #[doc(alias = "G_REGEX_NEWLINE_CR")]
652 const NEWLINE_CR = ffi::G_REGEX_NEWLINE_CR as _;
653 /// Usually any newline character or character sequence is
654 /// recognized. If this option is set, the only recognized newline character
655 /// is '\n'.
656 #[doc(alias = "G_REGEX_NEWLINE_LF")]
657 const NEWLINE_LF = ffi::G_REGEX_NEWLINE_LF as _;
658 /// Usually any newline character or character sequence is
659 /// recognized. If this option is set, the only recognized newline character
660 /// sequence is '\r\n'.
661 #[doc(alias = "G_REGEX_NEWLINE_CRLF")]
662 const NEWLINE_CRLF = ffi::G_REGEX_NEWLINE_CRLF as _;
663 /// Usually any newline character or character sequence
664 /// is recognized. If this option is set, the only recognized newline character
665 /// sequences are '\r', '\n', and '\r\n'. Since: 2.34
666 #[doc(alias = "G_REGEX_NEWLINE_ANYCRLF")]
667 const NEWLINE_ANYCRLF = ffi::G_REGEX_NEWLINE_ANYCRLF as _;
668 /// Usually any newline character or character sequence
669 /// is recognised. If this option is set, then "\R" only recognizes the newline
670 /// characters '\r', '\n' and '\r\n'. Since: 2.34
671 #[doc(alias = "G_REGEX_BSR_ANYCRLF")]
672 const BSR_ANYCRLF = ffi::G_REGEX_BSR_ANYCRLF as _;
673 /// Changes behaviour so that it is compatible with
674 /// JavaScript rather than PCRE. Since GLib 2.74 this is no longer supported,
675 /// as libpcre2 does not support it. Since: 2.34 Deprecated: 2.74
676 #[doc(alias = "G_REGEX_JAVASCRIPT_COMPAT")]
677 const JAVASCRIPT_COMPAT = ffi::G_REGEX_JAVASCRIPT_COMPAT as _;
678 }
679}
680
681#[doc(hidden)]
682impl IntoGlib for RegexCompileFlags {
683 type GlibType = ffi::GRegexCompileFlags;
684
685 #[inline]
686 fn into_glib(self) -> ffi::GRegexCompileFlags {
687 self.bits()
688 }
689}
690
691#[doc(hidden)]
692impl FromGlib<ffi::GRegexCompileFlags> for RegexCompileFlags {
693 #[inline]
694 unsafe fn from_glib(value: ffi::GRegexCompileFlags) -> Self {
695 Self::from_bits_truncate(value)
696 }
697}
698
699bitflags! {
700 /// Flags specifying match-time options.
701 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
702 #[doc(alias = "GRegexMatchFlags")]
703 pub struct RegexMatchFlags: u32 {
704 /// No special options set. Since: 2.74
705 #[doc(alias = "G_REGEX_MATCH_DEFAULT")]
706 const DEFAULT = ffi::G_REGEX_MATCH_DEFAULT as _;
707 /// The pattern is forced to be "anchored", that is,
708 /// it is constrained to match only at the first matching point in the
709 /// string that is being searched. This effect can also be achieved by
710 /// appropriate constructs in the pattern itself such as the "^"
711 /// metacharacter.
712 #[doc(alias = "G_REGEX_MATCH_ANCHORED")]
713 const ANCHORED = ffi::G_REGEX_MATCH_ANCHORED as _;
714 /// Specifies that first character of the string is
715 /// not the beginning of a line, so the circumflex metacharacter should
716 /// not match before it. Setting this without [`RegexCompileFlags::MULTILINE`][crate::RegexCompileFlags::MULTILINE] (at
717 /// compile time) causes circumflex never to match. This option affects
718 /// only the behaviour of the circumflex metacharacter, it does not
719 /// affect "\A".
720 #[doc(alias = "G_REGEX_MATCH_NOTBOL")]
721 const NOTBOL = ffi::G_REGEX_MATCH_NOTBOL as _;
722 /// Specifies that the end of the subject string is
723 /// not the end of a line, so the dollar metacharacter should not match
724 /// it nor (except in multiline mode) a newline immediately before it.
725 /// Setting this without [`RegexCompileFlags::MULTILINE`][crate::RegexCompileFlags::MULTILINE] (at compile time) causes
726 /// dollar never to match. This option affects only the behaviour of
727 /// the dollar metacharacter, it does not affect "\Z" or "\z".
728 #[doc(alias = "G_REGEX_MATCH_NOTEOL")]
729 const NOTEOL = ffi::G_REGEX_MATCH_NOTEOL as _;
730 /// An empty string is not considered to be a valid
731 /// match if this option is set. If there are alternatives in the pattern,
732 /// they are tried. If all the alternatives match the empty string, the
733 /// entire match fails. For example, if the pattern "a?b?" is applied to
734 /// a string not beginning with "a" or "b", it matches the empty string
735 /// at the start of the string. With this flag set, this match is not
736 /// valid, so GRegex searches further into the string for occurrences
737 /// of "a" or "b".
738 #[doc(alias = "G_REGEX_MATCH_NOTEMPTY")]
739 const NOTEMPTY = ffi::G_REGEX_MATCH_NOTEMPTY as _;
740 /// Turns on the partial matching feature, for more
741 /// documentation on partial matching see g_match_info_is_partial_match().
742 #[doc(alias = "G_REGEX_MATCH_PARTIAL")]
743 const PARTIAL = ffi::G_REGEX_MATCH_PARTIAL as _;
744 /// Overrides the newline definition set when
745 /// creating a new #GRegex, setting the '\r' character as line terminator.
746 #[doc(alias = "G_REGEX_MATCH_NEWLINE_CR")]
747 const NEWLINE_CR = ffi::G_REGEX_MATCH_NEWLINE_CR as _;
748 /// Overrides the newline definition set when
749 /// creating a new #GRegex, setting the '\n' character as line terminator.
750 #[doc(alias = "G_REGEX_MATCH_NEWLINE_LF")]
751 const NEWLINE_LF = ffi::G_REGEX_MATCH_NEWLINE_LF as _;
752 /// Overrides the newline definition set when
753 /// creating a new #GRegex, setting the '\r\n' characters sequence as line terminator.
754 #[doc(alias = "G_REGEX_MATCH_NEWLINE_CRLF")]
755 const NEWLINE_CRLF = ffi::G_REGEX_MATCH_NEWLINE_CRLF as _;
756 /// Overrides the newline definition set when
757 /// creating a new #GRegex, any Unicode newline sequence
758 /// is recognised as a newline. These are '\r', '\n' and '\rn', and the
759 /// single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
760 /// U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
761 /// U+2029 PARAGRAPH SEPARATOR.
762 #[doc(alias = "G_REGEX_MATCH_NEWLINE_ANY")]
763 const NEWLINE_ANY = ffi::G_REGEX_MATCH_NEWLINE_ANY as _;
764 /// Overrides the newline definition set when
765 /// creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence
766 /// is recognized as a newline. Since: 2.34
767 #[doc(alias = "G_REGEX_MATCH_NEWLINE_ANYCRLF")]
768 const NEWLINE_ANYCRLF = ffi::G_REGEX_MATCH_NEWLINE_ANYCRLF as _;
769 /// Overrides the newline definition for "\R" set when
770 /// creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences
771 /// are recognized as a newline by "\R". Since: 2.34
772 #[doc(alias = "G_REGEX_MATCH_BSR_ANYCRLF")]
773 const BSR_ANYCRLF = ffi::G_REGEX_MATCH_BSR_ANYCRLF as _;
774 /// Overrides the newline definition for "\R" set when
775 /// creating a new #GRegex; any Unicode newline character or character sequence
776 /// are recognized as a newline by "\R". These are '\r', '\n' and '\rn', and the
777 /// single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
778 /// U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
779 /// U+2029 PARAGRAPH SEPARATOR. Since: 2.34
780 #[doc(alias = "G_REGEX_MATCH_BSR_ANY")]
781 const BSR_ANY = ffi::G_REGEX_MATCH_BSR_ANY as _;
782 /// An alias for [`PARTIAL`][Self::PARTIAL]. Since: 2.34
783 #[doc(alias = "G_REGEX_MATCH_PARTIAL_SOFT")]
784 const PARTIAL_SOFT = ffi::G_REGEX_MATCH_PARTIAL_SOFT as _;
785 /// Turns on the partial matching feature. In contrast to
786 /// to [`PARTIAL_SOFT`][Self::PARTIAL_SOFT], this stops matching as soon as a partial match
787 /// is found, without continuing to search for a possible complete match. See
788 /// g_match_info_is_partial_match() for more information. Since: 2.34
789 #[doc(alias = "G_REGEX_MATCH_PARTIAL_HARD")]
790 const PARTIAL_HARD = ffi::G_REGEX_MATCH_PARTIAL_HARD as _;
791 /// Like [`NOTEMPTY`][Self::NOTEMPTY], but only applied to
792 /// the start of the matched string. For anchored
793 /// patterns this can only happen for pattern containing "\K". Since: 2.34
794 #[doc(alias = "G_REGEX_MATCH_NOTEMPTY_ATSTART")]
795 const NOTEMPTY_ATSTART = ffi::G_REGEX_MATCH_NOTEMPTY_ATSTART as _;
796 }
797}
798
799#[doc(hidden)]
800impl IntoGlib for RegexMatchFlags {
801 type GlibType = ffi::GRegexMatchFlags;
802
803 #[inline]
804 fn into_glib(self) -> ffi::GRegexMatchFlags {
805 self.bits()
806 }
807}
808
809#[doc(hidden)]
810impl FromGlib<ffi::GRegexMatchFlags> for RegexMatchFlags {
811 #[inline]
812 unsafe fn from_glib(value: ffi::GRegexMatchFlags) -> Self {
813 Self::from_bits_truncate(value)
814 }
815}
816
817bitflags! {
818 /// Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().
819 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
820 #[doc(alias = "GSpawnFlags")]
821 pub struct SpawnFlags: u32 {
822 /// no flags, default behaviour
823 #[doc(alias = "G_SPAWN_DEFAULT")]
824 const DEFAULT = ffi::G_SPAWN_DEFAULT as _;
825 /// the parent's open file descriptors will
826 /// be inherited by the child; otherwise all descriptors except stdin,
827 /// stdout and stderr will be closed before calling exec() in the child.
828 #[doc(alias = "G_SPAWN_LEAVE_DESCRIPTORS_OPEN")]
829 const LEAVE_DESCRIPTORS_OPEN = ffi::G_SPAWN_LEAVE_DESCRIPTORS_OPEN as _;
830 /// the child will not be automatically reaped;
831 /// you must use g_child_watch_add() yourself (or call waitpid() or handle
832 /// `SIGCHLD` yourself), or the child will become a zombie.
833 #[doc(alias = "G_SPAWN_DO_NOT_REAP_CHILD")]
834 const DO_NOT_REAP_CHILD = ffi::G_SPAWN_DO_NOT_REAP_CHILD as _;
835 /// `argv[0]` need not be an absolute path, it will be
836 /// looked for in the user's `PATH`.
837 #[doc(alias = "G_SPAWN_SEARCH_PATH")]
838 const SEARCH_PATH = ffi::G_SPAWN_SEARCH_PATH as _;
839 /// the child's standard output will be discarded,
840 /// instead of going to the same location as the parent's standard output.
841 #[doc(alias = "G_SPAWN_STDOUT_TO_DEV_NULL")]
842 const STDOUT_TO_DEV_NULL = ffi::G_SPAWN_STDOUT_TO_DEV_NULL as _;
843 /// the child's standard error will be discarded.
844 #[doc(alias = "G_SPAWN_STDERR_TO_DEV_NULL")]
845 const STDERR_TO_DEV_NULL = ffi::G_SPAWN_STDERR_TO_DEV_NULL as _;
846 /// the child will inherit the parent's standard
847 /// input (by default, the child's standard input is attached to `/dev/null`).
848 #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDIN")]
849 const CHILD_INHERITS_STDIN = ffi::G_SPAWN_CHILD_INHERITS_STDIN as _;
850 /// the first element of `argv` is the file to
851 /// execute, while the remaining elements are the actual argument vector
852 /// to pass to the file. Normally g_spawn_async_with_pipes() uses `argv[0]`
853 /// as the file to execute, and passes all of `argv` to the child.
854 #[doc(alias = "G_SPAWN_FILE_AND_ARGV_ZERO")]
855 const FILE_AND_ARGV_ZERO = ffi::G_SPAWN_FILE_AND_ARGV_ZERO as _;
856 /// if `argv[0]` is not an absolute path,
857 /// it will be looked for in the `PATH` from the passed child environment.
858 /// Since: 2.34
859 #[doc(alias = "G_SPAWN_SEARCH_PATH_FROM_ENVP")]
860 const SEARCH_PATH_FROM_ENVP = ffi::G_SPAWN_SEARCH_PATH_FROM_ENVP as _;
861 /// create all pipes with the `O_CLOEXEC` flag set.
862 /// Since: 2.40
863 #[doc(alias = "G_SPAWN_CLOEXEC_PIPES")]
864 const CLOEXEC_PIPES = ffi::G_SPAWN_CLOEXEC_PIPES as _;
865 /// The child will inherit the parent's standard output.
866 #[cfg(feature = "v2_74")]
867 #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
868 #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDOUT")]
869 const CHILD_INHERITS_STDOUT = ffi::G_SPAWN_CHILD_INHERITS_STDOUT as _;
870 /// The child will inherit the parent's standard error.
871 #[cfg(feature = "v2_74")]
872 #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
873 #[doc(alias = "G_SPAWN_CHILD_INHERITS_STDERR")]
874 const CHILD_INHERITS_STDERR = ffi::G_SPAWN_CHILD_INHERITS_STDERR as _;
875 /// The child's standard input is attached to `/dev/null`.
876 #[cfg(feature = "v2_74")]
877 #[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
878 #[doc(alias = "G_SPAWN_STDIN_FROM_DEV_NULL")]
879 const STDIN_FROM_DEV_NULL = ffi::G_SPAWN_STDIN_FROM_DEV_NULL as _;
880 }
881}
882
883#[doc(hidden)]
884impl IntoGlib for SpawnFlags {
885 type GlibType = ffi::GSpawnFlags;
886
887 #[inline]
888 fn into_glib(self) -> ffi::GSpawnFlags {
889 self.bits()
890 }
891}
892
893#[doc(hidden)]
894impl FromGlib<ffi::GSpawnFlags> for SpawnFlags {
895 #[inline]
896 unsafe fn from_glib(value: ffi::GSpawnFlags) -> Self {
897 Self::from_bits_truncate(value)
898 }
899}
900
901#[cfg(feature = "v2_66")]
902bitflags! {
903 /// Flags that describe a URI.
904 ///
905 /// When parsing a URI, if you need to choose different flags based on
906 /// the type of URI, you can use g_uri_peek_scheme() on the URI string
907 /// to check the scheme first, and use that to decide what flags to
908 /// parse it with.
909 #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
910 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
911 #[doc(alias = "GUriFlags")]
912 pub struct UriFlags: u32 {
913 /// No flags set.
914 #[doc(alias = "G_URI_FLAGS_NONE")]
915 const NONE = ffi::G_URI_FLAGS_NONE as _;
916 /// Parse the URI more relaxedly than the
917 /// [RFC 3986](https://tools.ietf.org/html/rfc3986) grammar specifies,
918 /// fixing up or ignoring common mistakes in URIs coming from external
919 /// sources. This is also needed for some obscure URI schemes where `;`
920 /// separates the host from the path. Don’t use this flag unless you need to.
921 #[doc(alias = "G_URI_FLAGS_PARSE_RELAXED")]
922 const PARSE_RELAXED = ffi::G_URI_FLAGS_PARSE_RELAXED as _;
923 /// The userinfo field may contain a password,
924 /// which will be separated from the username by `:`.
925 #[doc(alias = "G_URI_FLAGS_HAS_PASSWORD")]
926 const HAS_PASSWORD = ffi::G_URI_FLAGS_HAS_PASSWORD as _;
927 /// The userinfo may contain additional
928 /// authentication-related parameters, which will be separated from
929 /// the username and/or password by `;`.
930 #[doc(alias = "G_URI_FLAGS_HAS_AUTH_PARAMS")]
931 const HAS_AUTH_PARAMS = ffi::G_URI_FLAGS_HAS_AUTH_PARAMS as _;
932 /// When parsing a URI, this indicates that `%`-encoded
933 /// characters in the userinfo, path, query, and fragment fields
934 /// should not be decoded. (And likewise the host field if
935 /// [`NON_DNS`][Self::NON_DNS] is also set.) When building a URI, it indicates
936 /// that you have already `%`-encoded the components, and so #GUri
937 /// should not do any encoding itself.
938 #[doc(alias = "G_URI_FLAGS_ENCODED")]
939 const ENCODED = ffi::G_URI_FLAGS_ENCODED as _;
940 /// The host component should not be assumed to be a
941 /// DNS hostname or IP address (for example, for `smb` URIs with NetBIOS
942 /// hostnames).
943 #[doc(alias = "G_URI_FLAGS_NON_DNS")]
944 const NON_DNS = ffi::G_URI_FLAGS_NON_DNS as _;
945 /// Same as [`ENCODED`][Self::ENCODED], for the query
946 /// field only.
947 #[doc(alias = "G_URI_FLAGS_ENCODED_QUERY")]
948 const ENCODED_QUERY = ffi::G_URI_FLAGS_ENCODED_QUERY as _;
949 /// Same as [`ENCODED`][Self::ENCODED], for the path only.
950 #[doc(alias = "G_URI_FLAGS_ENCODED_PATH")]
951 const ENCODED_PATH = ffi::G_URI_FLAGS_ENCODED_PATH as _;
952 /// Same as [`ENCODED`][Self::ENCODED], for the
953 /// fragment only.
954 #[doc(alias = "G_URI_FLAGS_ENCODED_FRAGMENT")]
955 const ENCODED_FRAGMENT = ffi::G_URI_FLAGS_ENCODED_FRAGMENT as _;
956 /// A scheme-based normalization will be applied.
957 /// For example, when parsing an HTTP URI changing omitted path to `/` and
958 /// omitted port to `80`; and when building a URI, changing empty path to `/`
959 /// and default port `80`). This only supports a subset of known schemes. (Since: 2.68)
960 #[doc(alias = "G_URI_FLAGS_SCHEME_NORMALIZE")]
961 const SCHEME_NORMALIZE = ffi::G_URI_FLAGS_SCHEME_NORMALIZE as _;
962 }
963}
964
965#[cfg(feature = "v2_66")]
966#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
967#[doc(hidden)]
968impl IntoGlib for UriFlags {
969 type GlibType = ffi::GUriFlags;
970
971 #[inline]
972 fn into_glib(self) -> ffi::GUriFlags {
973 self.bits()
974 }
975}
976
977#[cfg(feature = "v2_66")]
978#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
979#[doc(hidden)]
980impl FromGlib<ffi::GUriFlags> for UriFlags {
981 #[inline]
982 unsafe fn from_glib(value: ffi::GUriFlags) -> Self {
983 Self::from_bits_truncate(value)
984 }
985}
986
987#[cfg(feature = "v2_66")]
988bitflags! {
989 /// Flags describing what parts of the URI to hide in
990 /// g_uri_to_string_partial(). Note that [`PASSWORD`][Self::PASSWORD] and
991 /// [`AUTH_PARAMS`][Self::AUTH_PARAMS] will only work if the #GUri was parsed with
992 /// the corresponding flags.
993 #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
994 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
995 #[doc(alias = "GUriHideFlags")]
996 pub struct UriHideFlags: u32 {
997 /// No flags set.
998 #[doc(alias = "G_URI_HIDE_NONE")]
999 const NONE = ffi::G_URI_HIDE_NONE as _;
1000 /// Hide the userinfo.
1001 #[doc(alias = "G_URI_HIDE_USERINFO")]
1002 const USERINFO = ffi::G_URI_HIDE_USERINFO as _;
1003 /// Hide the password.
1004 #[doc(alias = "G_URI_HIDE_PASSWORD")]
1005 const PASSWORD = ffi::G_URI_HIDE_PASSWORD as _;
1006 /// Hide the auth_params.
1007 #[doc(alias = "G_URI_HIDE_AUTH_PARAMS")]
1008 const AUTH_PARAMS = ffi::G_URI_HIDE_AUTH_PARAMS as _;
1009 /// Hide the query.
1010 #[doc(alias = "G_URI_HIDE_QUERY")]
1011 const QUERY = ffi::G_URI_HIDE_QUERY as _;
1012 /// Hide the fragment.
1013 #[doc(alias = "G_URI_HIDE_FRAGMENT")]
1014 const FRAGMENT = ffi::G_URI_HIDE_FRAGMENT as _;
1015 }
1016}
1017
1018#[cfg(feature = "v2_66")]
1019#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
1020#[doc(hidden)]
1021impl IntoGlib for UriHideFlags {
1022 type GlibType = ffi::GUriHideFlags;
1023
1024 #[inline]
1025 fn into_glib(self) -> ffi::GUriHideFlags {
1026 self.bits()
1027 }
1028}
1029
1030#[cfg(feature = "v2_66")]
1031#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
1032#[doc(hidden)]
1033impl FromGlib<ffi::GUriHideFlags> for UriHideFlags {
1034 #[inline]
1035 unsafe fn from_glib(value: ffi::GUriHideFlags) -> Self {
1036 Self::from_bits_truncate(value)
1037 }
1038}
1039
1040#[cfg(feature = "v2_66")]
1041bitflags! {
1042 /// Flags modifying the way parameters are handled by g_uri_parse_params() and
1043 /// #GUriParamsIter.
1044 #[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
1045 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
1046 #[doc(alias = "GUriParamsFlags")]
1047 pub struct UriParamsFlags: u32 {
1048 /// No flags set.
1049 #[doc(alias = "G_URI_PARAMS_NONE")]
1050 const NONE = ffi::G_URI_PARAMS_NONE as _;
1051 /// Parameter names are case insensitive.
1052 #[doc(alias = "G_URI_PARAMS_CASE_INSENSITIVE")]
1053 const CASE_INSENSITIVE = ffi::G_URI_PARAMS_CASE_INSENSITIVE as _;
1054 /// Replace `+` with space character. Only useful for
1055 /// URLs on the web, using the `https` or `http` schemas.
1056 #[doc(alias = "G_URI_PARAMS_WWW_FORM")]
1057 const WWW_FORM = ffi::G_URI_PARAMS_WWW_FORM as _;
1058 /// See [`UriFlags::PARSE_RELAXED`][crate::UriFlags::PARSE_RELAXED].
1059 #[doc(alias = "G_URI_PARAMS_PARSE_RELAXED")]
1060 const PARSE_RELAXED = ffi::G_URI_PARAMS_PARSE_RELAXED as _;
1061 }
1062}
1063
1064#[cfg(feature = "v2_66")]
1065#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
1066#[doc(hidden)]
1067impl IntoGlib for UriParamsFlags {
1068 type GlibType = ffi::GUriParamsFlags;
1069
1070 #[inline]
1071 fn into_glib(self) -> ffi::GUriParamsFlags {
1072 self.bits()
1073 }
1074}
1075
1076#[cfg(feature = "v2_66")]
1077#[cfg_attr(docsrs, doc(cfg(feature = "v2_66")))]
1078#[doc(hidden)]
1079impl FromGlib<ffi::GUriParamsFlags> for UriParamsFlags {
1080 #[inline]
1081 unsafe fn from_glib(value: ffi::GUriParamsFlags) -> Self {
1082 Self::from_bits_truncate(value)
1083 }
1084}