use configurable as a key

This commit is contained in:
Andy Killorin 2025-03-08 19:18:25 -05:00
commit 5b3347bb00
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -1,4 +1,4 @@
use std::{collections::VecDeque, ops::{Div, Range, Sub}};
use std::{collections::VecDeque, ops::{Deref, Div, Index, Range, Sub}};
use common::{CamState, ControlPacket, SensorData};
use anyhow::Result;
@ -22,7 +22,7 @@ impl AutoInterface {
/// request auto enable, fails if the driver does not grant it
pub fn enable(&self) -> Result<()> {unimplemented!()}
pub fn enabled(&self) -> bool {unimplemented!()}
pub fn auto_conf(&self) -> AutoConfig {unimplemented!()}
pub fn conf(&self, key: &'static Configurable) -> f32 {unimplemented!()}
fn send_message(&self, message: String) {unimplemented!()}
}
@ -53,6 +53,14 @@ impl Configurable {
}
}
impl Deref for Configurable {
type Target = str;
fn deref(&self) -> &Self::Target {
self.name
}
}
impl Default for Configurable {
fn default() -> Self {
Self { name: Default::default(), description: Default::default(), default: Default::default(), min: 0.0, max: 1.0 }