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 (
18 "simple_divisible",
20 vec![
21 FilePatch::new("processes.csv")
22 .with_deletion("RGASBR,Gas boiler,all,RSHEAT,2020,2040,1.0,")
23 .with_addition("RGASBR,Gas boiler,all,RSHEAT,2020,2040,1.0,1000"),
24 ],
25 ),
26 (
28 "simple_npv",
29 vec![
30 FilePatch::new("agent_objectives.csv")
31 .with_deletion("A0_RES,all,lcox,,")
32 .with_addition("A0_RES,all,npv,,"),
33 ],
34 ),
35 ]
36 .into_iter()
37 .collect()
38}
39
40pub fn get_patch_names() -> impl Iterator<Item = &'static str> {
42 PATCHES.keys().copied()
43}
44
45pub fn get_patches(name: &str) -> Result<&[FilePatch]> {
47 Ok(PATCHES
48 .get(name)
49 .with_context(|| format!("Patched example '{name}' not found"))?)
50}