pub struct Preset {
pub name: &'static str,
pub description: &'static str,
pub content: &'static str,
}
pub static PRESETS: &[Preset] = &[
Preset {
name: "python",
description: "Python: PEP 8 warm-ups, == None, mutable defaults, \
top-level function/class scopes",
content: include_str!("../presets/python.yaml"),
},
Preset {
name: "ini",
description: "INI: tabs, trailing whitespace, empty values, \
a [server] section example",
content: include_str!("../presets/ini.yaml"),
},
Preset {
name: "markdown",
description: "Markdown: tabs, trailing whitespace, bare URLs",
content: include_str!("../presets/markdown.yaml"),
},
];
pub fn lookup(name: &str) -> Option<&'static Preset> {
PRESETS.iter().find(|preset| preset.name == name)
}
pub fn names() -> String {
PRESETS
.iter()
.map(|preset| preset.name)
.collect::<Vec<_>>()
.join(", ")
}