mirror of
https://github.com/csehviktor/status-monitor.git
synced 2025-08-08 18:06:14 +02:00
use string instead
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user