zng_ext_config/
yaml.rs

1use super::*;
2
3/// Represents a config source that synchronizes with a YAML file.
4pub type YamlConfig = SyncConfig<YamlBackend>;
5
6#[doc(hidden)]
7pub struct YamlBackend;
8impl SyncConfigBackend for YamlBackend {
9    fn read(mut file: WatchFile) -> io::Result<RawConfigMap> {
10        file.yaml().map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
11    }
12
13    fn write(file: &mut WriteFile, map: &RawConfigMap) -> io::Result<()> {
14        file.write_yaml(map)
15    }
16}