diff --git a/CHANGELOG.md b/CHANGELOG.md index 17e534a..f8718b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +# [v0.13.1] 2025-03-21 + +- Bugfix due to operator precendence for `PusTcSecondaryHeader::pus_version`, + `PusTcSecondaryHeaderWithoutTimestamp::pus_version`, `CdsTime::from_bytes_with_u16_days` and + `CdsTime::from_bytes_with_u24_days` + # [v0.13.0] 2024-11-08 - Bumped MSRV to 1.81.0 @@ -561,3 +567,7 @@ The timestamp of `PusTm` is now optional. See Added and Changed section for deta Initial release with CCSDS Space Packet Primary Header implementation and basic PUS TC and TM implementations. + +[v0.13.1]: https://egit.irs.uni-stuttgart.de/rust/spacepackets/compare/v0.13.0...v0.13.1 +[v0.13.0]: https://egit.irs.uni-stuttgart.de/rust/spacepackets/compare/v0.12.0...v0.13.0 +[v0.12.0]: https://egit.irs.uni-stuttgart.de/rust/spacepackets/compare/v0.11.2...v0.12.0 diff --git a/src/cfdp/pdu/nak.rs b/src/cfdp/pdu/nak.rs index 0c9aedc..7f23a15 100644 --- a/src/cfdp/pdu/nak.rs +++ b/src/cfdp/pdu/nak.rs @@ -61,7 +61,7 @@ impl<'seg_reqs> NakPduCreator<'seg_reqs> { start_of_scope: u32, end_of_scope: u32, segment_requests: &'seg_reqs [(u32, u32)], - ) -> Result { + ) -> Result, PduError> { let mut passed_segment_requests = None; if !segment_requests.is_empty() { passed_segment_requests = Some(SegmentRequests::U32Pairs(segment_requests)); @@ -79,7 +79,7 @@ impl<'seg_reqs> NakPduCreator<'seg_reqs> { start_of_scope: u64, end_of_scope: u64, segment_requests: &'seg_reqs [(u64, u64)], - ) -> Result { + ) -> Result, PduError> { let mut passed_segment_requests = None; if !segment_requests.is_empty() { passed_segment_requests = Some(SegmentRequests::U64Pairs(segment_requests)); @@ -97,7 +97,7 @@ impl<'seg_reqs> NakPduCreator<'seg_reqs> { start_of_scope: u64, end_of_scope: u64, segment_requests: Option>, - ) -> Result { + ) -> Result, PduError> { // Force correct direction flag. pdu_header.pdu_conf.direction = Direction::TowardsSender; if let Some(ref segment_requests) = segment_requests { @@ -269,7 +269,7 @@ impl SegReqFromBytes for u64 { } } -impl<'a, T> Iterator for SegmentRequestIter<'a, T> +impl Iterator for SegmentRequestIter<'_, T> where T: SegReqFromBytes, { @@ -282,8 +282,8 @@ where } } -impl<'a, 'b> PartialEq> for SegmentRequestIter<'b, u32> { - fn eq(&self, other: &SegmentRequests) -> bool { +impl<'a> PartialEq> for SegmentRequestIter<'_, u32> { + fn eq(&self, other: &SegmentRequests<'a>) -> bool { match other { SegmentRequests::U32Pairs(pairs) => self.compare_pairs(pairs), SegmentRequests::U64Pairs(pairs) => { @@ -296,8 +296,8 @@ impl<'a, 'b> PartialEq> for SegmentRequestIter<'b, u32> { } } -impl<'a, 'b> PartialEq> for SegmentRequestIter<'b, u64> { - fn eq(&self, other: &SegmentRequests) -> bool { +impl<'a> PartialEq> for SegmentRequestIter<'_, u64> { + fn eq(&self, other: &SegmentRequests<'a>) -> bool { match other { SegmentRequests::U32Pairs(pairs) => { if pairs.is_empty() && self.seq_req_raw.is_empty() { @@ -310,7 +310,7 @@ impl<'a, 'b> PartialEq> for SegmentRequestIter<'b, u64> { } } -impl<'a, T> SegmentRequestIter<'a, T> +impl SegmentRequestIter<'_, T> where T: SegReqFromBytes + PartialEq, { @@ -374,11 +374,11 @@ impl CfdpPdu for NakPduReader<'_> { } impl<'seg_reqs> NakPduReader<'seg_reqs> { - pub fn new(buf: &'seg_reqs [u8]) -> Result { + pub fn new(buf: &'seg_reqs [u8]) -> Result, PduError> { Self::from_bytes(buf) } - pub fn from_bytes(buf: &'seg_reqs [u8]) -> Result { + pub fn from_bytes(buf: &'seg_reqs [u8]) -> Result, PduError> { let (pdu_header, mut current_idx) = PduHeader::from_bytes(buf)?; let full_len_without_crc = pdu_header.verify_length_and_checksum(buf)?; // Minimum length of 9: 1 byte directive field and start and end of scope for normal file @@ -474,7 +474,7 @@ impl<'seg_reqs> NakPduReader<'seg_reqs> { } } -impl<'a, 'b> PartialEq> for NakPduReader<'b> { +impl<'a> PartialEq> for NakPduReader<'_> { fn eq(&self, other: &NakPduCreator<'a>) -> bool { if self.pdu_header() != other.pdu_header() || self.end_of_scope() != other.end_of_scope() diff --git a/src/cfdp/tlv/mod.rs b/src/cfdp/tlv/mod.rs index 4826438..2b80cc6 100644 --- a/src/cfdp/tlv/mod.rs +++ b/src/cfdp/tlv/mod.rs @@ -398,7 +398,7 @@ impl GenericTlv for EntityIdTlv { } } -impl<'data> TryFrom> for EntityIdTlv { +impl TryFrom> for EntityIdTlv { type Error = TlvLvError; fn try_from(value: Tlv) -> Result { diff --git a/src/ecss/tc.rs b/src/ecss/tc.rs index 20ebe1a..437b0b9 100644 --- a/src/ecss/tc.rs +++ b/src/ecss/tc.rs @@ -115,7 +115,7 @@ pub mod zc { impl GenericPusTcSecondaryHeader for PusTcSecondaryHeader { #[inline] fn pus_version(&self) -> PusVersion { - PusVersion::try_from(self.version_ack >> 4 & 0b1111).unwrap_or(PusVersion::Invalid) + PusVersion::try_from((self.version_ack >> 4) & 0b1111).unwrap_or(PusVersion::Invalid) } #[inline] diff --git a/src/ecss/tm.rs b/src/ecss/tm.rs index d552ae9..d1b2792 100644 --- a/src/ecss/tm.rs +++ b/src/ecss/tm.rs @@ -120,7 +120,7 @@ pub mod zc { impl GenericPusTmSecondaryHeader for PusTmSecHeaderWithoutTimestamp { #[inline] fn pus_version(&self) -> PusVersion { - PusVersion::try_from(self.pus_version_and_sc_time_ref_status >> 4 & 0b1111) + PusVersion::try_from((self.pus_version_and_sc_time_ref_status >> 4) & 0b1111) .unwrap_or(PusVersion::Invalid) } @@ -1111,7 +1111,7 @@ mod tests { } fn verify_ping_reply_generic( - tm: &(impl CcsdsPacket + GenericPusTmSecondaryHeader + PusPacket), + tm: &(impl GenericPusTmSecondaryHeader + PusPacket), has_user_data: bool, exp_full_len: usize, ) { diff --git a/src/time/cds.rs b/src/time/cds.rs index 8e1ee00..b67f7cc 100644 --- a/src/time/cds.rs +++ b/src/time/cds.rs @@ -569,7 +569,7 @@ impl CdsTime { )); } let pfield = buf[0]; - match CcsdsTimeCode::try_from(pfield >> 4 & 0b111) { + match CcsdsTimeCode::try_from((pfield >> 4) & 0b111) { Ok(cds_type) => match cds_type { CcsdsTimeCode::Cds => (), _ => { @@ -582,7 +582,7 @@ impl CdsTime { _ => { return Err(TimestampError::InvalidTimeCode { expected: CcsdsTimeCode::Cds, - found: pfield >> 4 & 0b111, + found: (pfield >> 4) & 0b111, }); } };