2020-04-16 13:16:40 +02:00
|
|
|
use crate::common::*;
|
|
|
|
|
|
|
|
const PATH: &str = "bin/gen/config.yaml";
|
|
|
|
|
2020-04-19 04:14:26 +02:00
|
|
|
#[derive(Debug, Deserialize)]
|
2020-04-16 13:16:40 +02:00
|
|
|
pub(crate) struct Config {
|
|
|
|
pub(crate) changelog: BTreeMap<String, Metadata>,
|
|
|
|
pub(crate) examples: Vec<Example>,
|
2020-04-18 07:49:56 +02:00
|
|
|
pub(crate) packages: Vec<Package>,
|
2020-04-19 04:14:26 +02:00
|
|
|
pub(crate) references: Vec<ReferenceSection>,
|
2020-04-16 13:16:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Config {
|
|
|
|
#[throws]
|
|
|
|
pub(crate) fn load(root: &Path) -> Config {
|
|
|
|
let file = File::open(root.join(PATH))?;
|
|
|
|
serde_yaml::from_reader(file)?
|
|
|
|
}
|
|
|
|
}
|