Skip to content

Commit ab596b7

Browse files
committed
Support serde.
1 parent 4f04714 commit ab596b7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ license = "BSD-3-Clause"
1111

1212
[dependencies]
1313
micromath = "2.0"
14+
serde = { version = "1", default-features = false, features = ["derive"], optional = true }

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
use micromath::F32Ext;
66

77
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
8+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
89
pub enum AlgorithmType {
910
Voc,
1011
Nox,
1112
}
1213

1314
#[derive(Debug)]
15+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1416
pub struct GasIndexAlgorithm {
1517
state: GasIndexAlgorithmParams,
1618
}
@@ -44,6 +46,7 @@ impl GasIndexAlgorithm {
4446
}
4547

4648
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
49+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4750
pub struct GasIndexAlgorithmParams {
4851
pub algorithm_type: AlgorithmType,
4952
pub sampling_interval: f32,

0 commit comments

Comments
 (0)