mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-20 08:11:03 +02:00
feat: add feature flags
Flags allow you to disable certain functionality and compile with only select features to reduce build time. Resolves #54.
This commit is contained in:
parent
e83618b1d6
commit
c347b6c944
16 changed files with 249 additions and 62 deletions
|
@ -133,11 +133,16 @@ impl Config {
|
|||
.unwrap_or_default();
|
||||
|
||||
match extension {
|
||||
#[cfg(feature = "config+json")]
|
||||
"json" => serde_json::from_str(str).wrap_err("Invalid JSON config"),
|
||||
#[cfg(feature = "config+toml")]
|
||||
"toml" => toml::from_str(str).wrap_err("Invalid TOML config"),
|
||||
#[cfg(feature = "config+yaml")]
|
||||
"yaml" | "yml" => serde_yaml::from_str(str).wrap_err("Invalid YAML config"),
|
||||
#[cfg(feature = "config+corn")]
|
||||
"corn" => libcorn::from_str(str).wrap_err("Invalid Corn config"),
|
||||
_ => unreachable!(),
|
||||
_ => Err(Report::msg(format!("Unsupported config type: {extension}"))
|
||||
.note("You may need to recompile with support if available")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue