From c808340d9a5e3f3bb032d5461207452802adada7 Mon Sep 17 00:00:00 2001 From: yjh <yjh465402634@gmail.com> Date: Tue, 31 May 2022 15:25:52 +0800 Subject: [PATCH] sp-core: impl serde for some offchain types (#11512) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * sp-core: impl serde for some offchain types * Update primitives/core/src/offchain/mod.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * remove serde impls from OpaqueNetworkState/OpaqueMultiaddr * derive default Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> --- substrate/primitives/core/src/offchain/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/substrate/primitives/core/src/offchain/mod.rs b/substrate/primitives/core/src/offchain/mod.rs index 4ffadc3e403..3f0eed87a3a 100644 --- a/substrate/primitives/core/src/offchain/mod.rs +++ b/substrate/primitives/core/src/offchain/mod.rs @@ -208,12 +208,14 @@ impl OpaqueMultiaddr { #[derive( Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Default, RuntimeDebug, PassByInner, Encode, Decode, )] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Timestamp(u64); /// Duration type #[derive( Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Default, RuntimeDebug, PassByInner, Encode, Decode, )] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Duration(u64); impl Duration { -- GitLab