From f70e7f77d1517d67ff8f62ea5e10e4c6212ac30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Mon, 12 Apr 2021 17:43:04 +0200 Subject: [PATCH] Fix serialization of DVector --- src/base/dimension.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/base/dimension.rs b/src/base/dimension.rs index ec70dc4c..dd87647d 100644 --- a/src/base/dimension.rs +++ b/src/base/dimension.rs @@ -211,6 +211,26 @@ pub trait DimName: Dim { fn dim() -> usize; } +#[cfg(feature = "serde-serialize-no-std")] +impl Serialize for Const { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + ().serialize(serializer) + } +} + +#[cfg(feature = "serde-serialize-no-std")] +impl<'de, const D: usize> Deserialize<'de> for Const { + fn deserialize(deserializer: Des) -> Result + where + Des: Deserializer<'de>, + { + <()>::deserialize(deserializer).map(|_| Const::) + } +} + pub trait ToConst { type Const: DimName; }