Packet ID trait implementations #30

Merged
muellerr merged 10 commits from packet-id-trait-impls into main 2023-09-18 18:19:32 +02:00
Showing only changes of commit 2a0db6b21c - Show all commits

View File

@ -190,7 +190,7 @@ impl TryFrom<u8> for SequenceFlags {
/// Abstraction for the CCSDS Packet ID, which forms the last thirteen bits
/// of the first two bytes in the CCSDS primary header.
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[derive(Debug, Eq, Copy, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct PacketId {
pub ptype: PacketType,
@ -198,6 +198,12 @@ pub struct PacketId {
apid: u16,
}
impl PartialEq for PacketId {
fn eq(&self, other: &Self) -> bool {
self.raw().eq(&other.raw())
}
}
impl PartialOrd for PacketId {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
self.raw().partial_cmp(&other.raw())