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