lj_qualibration/src/conf.rs
Lapin Raving edfdc46172 first push
pour l'instant le programe detecte chacun des bord puis recadre le
trapeze en carrer avec une marge en cas de depassement.
2023-09-12 23:35:29 +02:00

23 lines
537 B
Rust

use config::Config;
use serde::{Deserialize, Serialize};
use std::error::Error;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Conf {
pub debug: bool,
pub laser_id: u8,
pub client_id: u8,
pub redis_url: String,
pub framerate: u8,
}
impl Conf {
pub fn new(path: &str) -> Result<Conf, Box<dyn Error>> {
let settings = Config::builder()
.add_source(config::File::with_name(path))
.build()?;
let conf: Conf = settings.try_deserialize()?;
Ok(conf)
}
}