From 83f5dd472ce4ffb12da7874efedf0a03bf20a62f Mon Sep 17 00:00:00 2001 From: prplV Date: Mon, 3 Mar 2025 13:49:48 +0300 Subject: [PATCH] borrowed strings without ownership (almost everywhere) --- src/structs.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/structs.rs b/src/structs.rs index 3f56f4a..b480f3a 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,25 +1,28 @@ // use std::collections::HashMap; use serde::{Serialize, Deserialize}; use serde_json::Value; +use std::borrow::Cow; // use anyhow::Result; // use std::sync::Arc; pub mod v3 { pub use super::*; // to prometheus and nmns - #[derive(Serialize, Deserialize, Debug)] - pub struct MetricOutput { + #[derive(Serialize, Deserialize, Debug, Clone)] + pub struct MetricOutput<'a> { pub id : String, #[serde(rename = "type")] json_type : String, addr : String, pub value : Value, + #[serde(rename = "description")] + pub desc : Option>, } #[derive(Serialize, Deserialize, Debug)] - pub struct PrometheusMetrics { + pub struct PrometheusMetrics<'a> { pub service_name: String, pub endpoint_name: String, - pub metrics: Vec, + pub metrics: Vec>, } } \ No newline at end of file