use std::collections::BTreeMap; use serde::{Deserialize, Serialize}; type Overrides = BTreeMap; type Dependencies = Vec; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Conf { plan: String, dependencies: Option, overrides: Option, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Application { name: String, } #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Plan { name: String, } #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(untagged)] pub enum Char { Application { char: Option, application: Application, config: BTreeMap, }, Plan { char: Option, plan: Plan, config: BTreeMap, }, } impl std::str::FromStr for Char { type Err = eyre::Error; fn from_str(s: &str) -> Result { let t: Char = toml::from_str(s)?; Ok(t) } }