rnetmon/src/outputs/mod.rs

22 lines
613 B
Rust

pub mod espeak;
pub mod light_beewi_bbl227;
pub mod matrix;
pub mod stdout;
use crate::output::*;
pub fn factory(
name: &str,
config: serde_yaml::Value,
) -> Result<Box<Output>, Box<dyn std::error::Error>> {
match name {
"stdout" => Ok(Box::new(stdout::Stdout::new(config)?)),
"espeak" => Ok(Box::new(espeak::Espeak::new(config)?)),
"matrix" => Ok(Box::new(matrix::Matrix::new(config)?)),
"light_beewi_bbl227" => Ok(Box::new(light_beewi_bbl227::BluetoothLightbulb::new(
config,
)?)),
_ => panic!("Unknown monitor name: {}", name),
}
}