Skip to content

Commit

Permalink
this is less confusing
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Dec 6, 2023
1 parent 38f5e3b commit 3818dcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Changed

- Renamed `SerializablePusPacket` to `WritablePusPacket`.
- Renamed `UnsignedPfc` to `PfcUnsigned` and `RealPfc` to `PfcReal`.
- Renamed `WritablePduPacket.written_len` and `SerializablePusPacket.len_packed` to `len_written`.
- Introduce custom implementation of `PartialEq` for `CommonPduConfig` which only compares the
values for the source entity ID, destination entity ID and transaction sequence number field to
Expand Down
16 changes: 8 additions & 8 deletions src/ecss/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub type Ptc = PacketTypeCodes;
#[derive(Debug, Copy, Clone, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[repr(u8)]
pub enum UnsignedPfc {
pub enum PfcUnsigned {
OneByte = 4,
TwelveBits = 8,
TwoBytes = 12,
Expand All @@ -137,7 +137,7 @@ pub enum UnsignedPfc {
#[derive(Debug, Copy, Clone, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[repr(u8)]
pub enum RealPfc {
pub enum PfcReal {
/// 4 octets simple precision format (IEEE)
Float = 1,
/// 8 octets simple precision format (IEEE)
Expand Down Expand Up @@ -483,16 +483,16 @@ mod tests {

#[test]
fn test_unsigned_pfc_from_u8() {
let pfc_raw = UnsignedPfc::OneByte as u8;
let pfc = UnsignedPfc::try_from(pfc_raw).unwrap();
assert_eq!(pfc, UnsignedPfc::OneByte);
let pfc_raw = PfcUnsigned::OneByte as u8;
let pfc = PfcUnsigned::try_from(pfc_raw).unwrap();
assert_eq!(pfc, PfcUnsigned::OneByte);
}

#[test]
fn test_real_pfc_from_u8() {
let pfc_raw = RealPfc::Double as u8;
let pfc = RealPfc::try_from(pfc_raw).unwrap();
assert_eq!(pfc, RealPfc::Double);
let pfc_raw = PfcReal::Double as u8;
let pfc = PfcReal::try_from(pfc_raw).unwrap();
assert_eq!(pfc, PfcReal::Double);
}

#[test]
Expand Down

0 comments on commit 3818dcd

Please sign in to comment.