cargo_e/
e_features.rs

1/// Returns a vector of feature flag strings.
2/// Enabled features are listed as-is while disabled ones are prefixed with "!".
3pub fn get_feature_flags() -> Vec<&'static str> {
4    [
5        if cfg!(feature = "tui") { "tui" } else { "!tui" },
6        if cfg!(feature = "concurrent") {
7            "concurrent"
8        } else {
9            "!concurrent"
10        },
11        if cfg!(target_os = "windows") {
12            "windows"
13        } else {
14            "!windows"
15        },
16        if cfg!(feature = "equivalent") {
17            "equivalent"
18        } else {
19            "!equivalent"
20        },
21    ]
22    .to_vec()
23}
24
25/// Returns a JSON string representation of the feature flags.
26pub fn get_feature_flags_json() -> String {
27    let flags = get_feature_flags();
28    format!(
29        "[{}]",
30        flags
31            .iter()
32            .map(|flag| format!("\"{}\"", flag))
33            .collect::<Vec<_>>()
34            .join(", ")
35    )
36}