diff --git a/primitive-types/impls/serde/CHANGELOG.md b/primitive-types/impls/serde/CHANGELOG.md index 43c06ddf5..0757363ea 100644 --- a/primitive-types/impls/serde/CHANGELOG.md +++ b/primitive-types/impls/serde/CHANGELOG.md @@ -4,8 +4,9 @@ The format is based on [Keep a Changelog]. [Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ -## [0.4.0] - 2022-08-31 +## [0.4.0] - 2022-09-02 - Support deserializing H256 et al from bytes or sequences of bytes, too. [#668](https://github.com/paritytech/parity-common/pull/668) +- Support deserializing H256 et al from newtype structs containing anything compatible, too. [#672](https://github.com/paritytech/parity-common/pull/672) - Migrated to 2021 edition, enforcing MSRV of `1.56.1`. [#601](https://github.com/paritytech/parity-common/pull/601) ## [0.3.2] - 2021-11-10 diff --git a/primitive-types/impls/serde/src/serialize.rs b/primitive-types/impls/serde/src/serialize.rs index 1426d3ddf..3017170e6 100644 --- a/primitive-types/impls/serde/src/serialize.rs +++ b/primitive-types/impls/serde/src/serialize.rs @@ -231,6 +231,10 @@ where } Ok(bytes) } + + fn visit_newtype_struct>(self, deserializer: D) -> Result { + deserializer.deserialize_bytes(self) + } } deserializer.deserialize_str(Visitor) @@ -309,6 +313,10 @@ where } self.visit_byte_buf(v) } + + fn visit_newtype_struct>(self, deserializer: D) -> Result { + deserializer.deserialize_bytes(self) + } } deserializer.deserialize_str(Visitor { len })