Add serde support

This commit is contained in:
Max Känner 2023-04-16 16:07:31 +02:00
parent 93f8051626
commit 89a91ae59c
2 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@ typenum = "1.16"
num-traits = { version = "0.2", default-features = false }
defmt = { version = "0.3", optional = true }
fixed = { version = "1.23.0", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"] }
[features]
default = ["std"]
@ -23,3 +24,4 @@ defmt = ["dep:defmt"]
fixed = ["dep:fixed"]
std = ["num-traits/std"]
nightly = []
serde = ["dep:serde"]

View File

@ -21,6 +21,7 @@ use typenum::{int::Z0, op, Integer};
use types::Unit;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,