small update for unsigned byte field
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
This commit is contained in:
parent
0e347b0e37
commit
d5172489cc
10
CHANGELOG.md
10
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<u64>` type constraint for `GenericUnsignedByteField`
|
||||
|
||||
# [v0.11.2] 2024-05-19
|
||||
|
||||
- Bumped MSRV to 1.68.2
|
||||
|
10
src/util.rs
10
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<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)
|
||||
|
Loading…
Reference in New Issue
Block a user