Lapin Raving
edfdc46172
pour l'instant le programe detecte chacun des bord puis recadre le trapeze en carrer avec une marge en cas de depassement.
23 lines
537 B
Rust
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)
|
|
}
|
|
}
|