formattable trait

This commit is contained in:
Robin Appelman 2026-06-27 00:13:40 +02:00
commit e13243f9a5
6 changed files with 36 additions and 18 deletions

View file

@ -5,6 +5,8 @@ use std::str::FromStr;
use serde::{Deserialize, Deserializer, de::Error};
use crate::device::FormattableDevice;
#[derive(Debug)]
pub struct TempState {
pub name: String,
@ -22,8 +24,10 @@ impl TempState {
humidity: 0,
}
}
}
pub fn format_open_metrics(&self) -> impl Display + '_ {
impl FormattableDevice for TempState {
fn format_open_metrics(&self) -> impl Display + '_ {
TempFormatter { device: self }
}
}