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; | pub const MQTT_SEND_INTERVAL: u64 = 5; | ||||||
|  |  | ||||||
| #[derive(Debug, Serialize, Deserialize)] | #[derive(Debug, Serialize, Deserialize)] | ||||||
| pub struct StatusMessage<'a> { | pub struct StatusMessage { | ||||||
|     pub agent: &'a str, |     pub agent: String, | ||||||
|     pub metrics: Metrics, |     pub metrics: Metrics, | ||||||
|     pub timestamp: DateTime<Utc>, |     pub timestamp: DateTime<Utc>, | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<'a> StatusMessage<'a> { | impl<'a> StatusMessage { | ||||||
|     pub fn new(agent: &'a str, metrics: Metrics) -> Self { |     pub fn new(agent: &'a str, metrics: Metrics) -> Self { | ||||||
|         Self { |         Self { | ||||||
|             agent, |             agent: agent.to_string(), | ||||||
|             metrics, |             metrics, | ||||||
|             timestamp: Utc::now(), |             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; |     type Error = serde_json::Error; | ||||||
|  |  | ||||||
|     fn try_from(value: &'a [u8]) -> Result<Self, Self::Error> { |     fn try_from(value: &'a [u8]) -> Result<Self, Self::Error> { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user