diff options
author | Marcel Müller <m.mueller@ifm.com> | 2022-04-20 08:50:26 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-04-20 09:22:06 +0200 |
commit | 524ddaba7f95f565897eeac5f0e9e02edb6e7cff (patch) | |
tree | b82ff6f837dbf185326d07f14b813d1f20803c16 | |
parent | 02e6f453cc4b6ef8239ebd7842dd9d354e0a4454 (diff) |
Add serde(untagged) to MeasurementValue
Signed-off-by: Marcel Müller <m.mueller@ifm.com>
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | crates/core/tedge_lib/src/measurement.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crates/core/tedge_lib/src/measurement.rs b/crates/core/tedge_lib/src/measurement.rs index 9c68fbc2..0b760c88 100644 --- a/crates/core/tedge_lib/src/measurement.rs +++ b/crates/core/tedge_lib/src/measurement.rs @@ -8,10 +8,7 @@ pub struct Measurement { impl Measurement { pub const fn new(name: String, value: MeasurementValue) -> Self { - Self { - name, - value - } + Self { name, value } } /// Get a reference to the measurement's name. @@ -31,11 +28,11 @@ impl tedge_api::plugin::Message for Measurement { #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] #[non_exhaustive] +#[serde(untagged)] pub enum MeasurementValue { Bool(bool), Float(f64), Text(String), List(Vec<MeasurementValue>), - Map(HashMap<String, MeasurementValue>) + Map(HashMap<String, MeasurementValue>), } - |