Debian Codegraph @

third_party/rust/clap_builder/src/util/mod.rs

raw
1 #![allow(clippy::single_component_path_imports)]
2
3 mod any_value;
4 pub(crate) mod flat_map;
5 pub(crate) mod flat_set;
6 mod graph;
7 mod id;
8 mod str_to_bool;
9
10 pub use self::id::Id;
11
12 pub(crate) use self::any_value::AnyValue;
13 pub(crate) use self::any_value::AnyValueId;
14 pub(crate) use self::flat_map::Entry;
15 pub(crate) use self::flat_map::FlatMap;
16 pub(crate) use self::flat_set::FlatSet;
17 pub(crate) use self::graph::ChildGraph;
18 pub(crate) use self::str_to_bool::str_to_bool;
19 pub(crate) use self::str_to_bool::FALSE_LITERALS;
20 pub(crate) use self::str_to_bool::TRUE_LITERALS;
21
22 pub(crate) mod color;
23
24 pub(crate) const SUCCESS_CODE: i32 = 0;
25 // While sysexists.h defines EX_USAGE as 64, this doesn't seem to be used much in practice but
26 // instead 2 seems to be frequently used.
27 // Examples
28 // - GNU `ls` returns 2
29 // - Python's `argparse` returns 2
30 pub(crate) const USAGE_CODE: i32 = 2;
31
32 #[cfg(not(feature = "unicode"))]
33 pub(crate) fn eq_ignore_case(left: &str, right: &str) -> bool {
34 left.eq_ignore_ascii_case(right)
35 }
36
37 #[cfg(feature = "unicode")]
38 pub(crate) use unicase::eq as eq_ignore_case;