use string instead

This commit is contained in:
csehviktor
2025-07-06 02:27:52 +02:00
parent 158369ffb3
commit d2a82e973b

View File

@@ -9,16 +9,16 @@ pub const MQTT_TOPIC: &str = "system/metrics";
pub const MQTT_SEND_INTERVAL: u64 = 5;
#[derive(Debug, Serialize, Deserialize)]
pub struct StatusMessage<'a> {
pub agent: &'a str,
pub struct StatusMessage {
pub agent: String,
pub metrics: Metrics,
pub timestamp: DateTime<Utc>,
}
impl<'a> StatusMessage<'a> {
impl<'a> StatusMessage {
pub fn new(agent: &'a str, metrics: Metrics) -> Self {
Self {
agent,
agent: agent.to_string(),
metrics,
timestamp: Utc::now(),
}
@@ -29,7 +29,7 @@ impl<'a> StatusMessage<'a> {
}
}
impl<'a> TryFrom<&'a [u8]> for StatusMessage<'a> {
impl<'a> TryFrom<&'a [u8]> for StatusMessage {
type Error = serde_json::Error;
fn try_from(value: &'a [u8]) -> Result<Self, Self::Error> {