diff --git a/CHANGELOG.md b/CHANGELOG.md index a7bfe3d..13d8485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +# [v0.12.0] 2024-06-06 + +## Added + +- `Default` impl for `GenericUnsignedByteField<()>` (also called `UnsignedByteFieldEmpty`) + +## Changed + +- Removed `Into` type constraint for `GenericUnsignedByteField` + # [v0.11.2] 2024-05-19 - Bumped MSRV to 1.68.2 diff --git a/src/util.rs b/src/util.rs index da80792..17dd92e 100644 --- a/src/util.rs +++ b/src/util.rs @@ -242,7 +242,7 @@ impl UnsignedEnum for UnsignedByteField { #[derive(Debug, Copy, Clone, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "defmt", derive(defmt::Format))] -pub struct GenericUnsignedByteField> { +pub struct GenericUnsignedByteField { value: TYPE, } @@ -290,6 +290,14 @@ pub type UbfU16 = UnsignedByteFieldU16; pub type UbfU32 = UnsignedByteFieldU32; pub type UbfU64 = UnsignedByteFieldU64; +impl Default for GenericUnsignedByteField<()> { + fn default() -> Self { + Self { + value: Default::default(), + } + } +} + impl From for UnsignedByteField { fn from(value: UnsignedByteFieldU8) -> Self { Self::new(1, value.value as u64)