small update for unsigned byte field
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2024-06-06 11:49:01 +02:00
parent 0e347b0e37
commit d5172489cc
2 changed files with 19 additions and 1 deletions

View File

@ -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<u64>` type constraint for `GenericUnsignedByteField`
# [v0.11.2] 2024-05-19
- Bumped MSRV to 1.68.2

View File

@ -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<TYPE: Copy + Into<u64>> {
pub struct GenericUnsignedByteField<TYPE: Copy> {
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<UnsignedByteFieldU8> for UnsignedByteField {
fn from(value: UnsignedByteFieldU8) -> Self {
Self::new(1, value.value as u64)