1use crate::patch::FilePatch;
5use anyhow::{Context, Result};
6use std::{collections::BTreeMap, sync::LazyLock};
7
8type PatchMap = BTreeMap<&'static str, Vec<FilePatch>>;
10
11static PATCHES: LazyLock<PatchMap> = LazyLock::new(get_all_patches);
13
14fn get_all_patches() -> PatchMap {
16 [(
17 "simple_divisible",
19 vec![
20 FilePatch::new("processes.csv")
21 .with_deletion("RGASBR,Gas boiler,all,RSHEAT,2020,2040,1.0,")
22 .with_addition("RGASBR,Gas boiler,all,RSHEAT,2020,2040,1.0,1000"),
23 ],
24 )]
25 .into_iter()
26 .collect()
27}
28
29pub fn get_patch_names() -> impl Iterator<Item = &'static str> {
31 PATCHES.keys().copied()
32}
33
34pub fn get_patches(name: &str) -> Result<&[FilePatch]> {
36 Ok(PATCHES
37 .get(name)
38 .with_context(|| format!("Patched example '{name}' not found"))?)
39}