1 #![allow(clippy::single_component_path_imports)]
2 
3 mod fnv;
4 mod graph;
5 mod id;
6 #[cfg(feature = "env")]
7 mod str_to_bool;
8 
9 pub use self::fnv::Key;
10 
11 #[cfg(feature = "env")]
12 pub(crate) use self::str_to_bool::str_to_bool;
13 pub(crate) use self::{graph::ChildGraph, id::Id};
14 
15 pub(crate) mod color;
16 
17 pub(crate) const SUCCESS_CODE: i32 = 0;
18 // While sysexists.h defines EX_USAGE as 64, this doesn't seem to be used much in practice but
19 // instead 2 seems to be frequently used.
20 // Examples
21 // - GNU `ls` returns 2
22 // - Python's `argparse` returns 2
23 pub(crate) const USAGE_CODE: i32 = 2;
24 
safe_exit(code: i32) -> !25 pub(crate) fn safe_exit(code: i32) -> ! {
26     use std::io::Write;
27 
28     let _ = std::io::stdout().lock().flush();
29     let _ = std::io::stderr().lock().flush();
30 
31     std::process::exit(code)
32 }
33 
34 #[cfg(not(feature = "unicode"))]
eq_ignore_case(left: &str, right: &str) -> bool35 pub(crate) fn eq_ignore_case(left: &str, right: &str) -> bool {
36     left.eq_ignore_ascii_case(right)
37 }
38 
39 #[cfg(feature = "unicode")]
40 pub(crate) use unicase::eq as eq_ignore_case;
41