formatter + implement status history

This commit is contained in:
csehviktor
2025-07-15 01:08:51 +02:00
parent 61fb1b1583
commit 6a311246f6
16 changed files with 245 additions and 110 deletions

View File

@@ -1,7 +1,7 @@
use crate::metrics::Metrics;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::Error;
use crate::metrics::Metrics;
pub mod metrics;
@@ -37,6 +37,14 @@ impl<'a> TryFrom<&'a [u8]> for StatusMessage {
}
}
impl TryFrom<String> for StatusMessage {
type Error = serde_json::Error;
fn try_from(value: String) -> Result<Self, Self::Error> {
serde_json::from_str(&value)
}
}
impl From<StatusMessage> for String {
fn from(msg: StatusMessage) -> String {
serde_json::to_string(&msg).unwrap_or_else(|_| String::new())