diff --git a/Cargo.toml b/Cargo.toml index 4d9fb3a..9634c09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,3 +11,4 @@ license = "BSD-3-Clause" [dependencies] micromath = "2.0" +serde = { version = "1", default-features = false, features = ["derive"], optional = true } diff --git a/src/lib.rs b/src/lib.rs index e0955ee..bc3f0f1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,12 +5,14 @@ use micromath::F32Ext; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum AlgorithmType { Voc, Nox, } #[derive(Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct GasIndexAlgorithm { state: GasIndexAlgorithmParams, } @@ -44,6 +46,7 @@ impl GasIndexAlgorithm { } #[derive(Copy, Clone, PartialEq, PartialOrd, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct GasIndexAlgorithmParams { pub algorithm_type: AlgorithmType, pub sampling_interval: f32,