From d391891991416237a9d5a81b968d56b138b3f05c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 Oct 2022 00:22:28 +0100 Subject: [PATCH] add EcssEnumerationExt trait extension --- src/ecss.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ecss.rs b/src/ecss.rs index d6139be..d497c65 100644 --- a/src/ecss.rs +++ b/src/ecss.rs @@ -1,5 +1,6 @@ //! Common definitions and helpers required to create PUS TMTC packets according to //! [ECSS-E-ST-70-41C](https://ecss.nl/standard/ecss-e-st-70-41c-space-engineering-telemetry-and-telecommand-packet-utilization-15-april-2016/) +use core::fmt::Debug; use crate::{ByteConversionError, CcsdsPacket, SizeMissmatch}; use core::mem::size_of; use crc::{Crc, CRC_16_IBM_3740}; @@ -171,6 +172,8 @@ pub trait EcssEnumeration { fn write_to_bytes(&self, buf: &mut [u8]) -> Result<(), ByteConversionError>; } +pub trait EcssEnumerationExt: EcssEnumeration + Debug + Copy + Clone + PartialEq + Eq {} + pub trait ToBeBytes { type ByteArray: AsRef<[u8]>; fn to_be_bytes(&self) -> Self::ByteArray; @@ -208,6 +211,7 @@ impl ToBeBytes for u64 { } } +#[derive (Debug, Copy, Clone, Eq, PartialEq)] pub struct GenericEcssEnumWrapper { val: TYPE, } @@ -239,6 +243,8 @@ impl EcssEnumeration for GenericEcssEnumWrapper { } } +impl EcssEnumerationExt for GenericEcssEnumWrapper {} + pub type EcssEnumU8 = GenericEcssEnumWrapper; pub type EcssEnumU16 = GenericEcssEnumWrapper; pub type EcssEnumU32 = GenericEcssEnumWrapper;