From d472c8476a5b455dc053d6b6ba30f15d72af9e8d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 6 Dec 2023 17:33:28 +0100 Subject: [PATCH] this can not really be deserialized --- src/cfdp/pdu/finished.rs | 17 +---------------- src/cfdp/tlv/mod.rs | 2 +- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/cfdp/pdu/finished.rs b/src/cfdp/pdu/finished.rs index 2e14647..f0aa2c0 100644 --- a/src/cfdp/pdu/finished.rs +++ b/src/cfdp/pdu/finished.rs @@ -34,12 +34,12 @@ pub enum FileStatus { /// /// For more information, refer to CFDP chapter 5.2.3. #[derive(Debug, Copy, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct FinishedPduCreator<'fs_responses> { pdu_header: PduHeader, condition_code: ConditionCode, delivery_code: DeliveryCode, file_status: FileStatus, + #[cfg_attr(feature = "serde", serde(borrow))] fs_responses: &'fs_responses [FilestoreResponseTlv<'fs_responses, 'fs_responses, 'fs_responses>], fault_location: Option, @@ -637,19 +637,4 @@ mod tests { let finished_pdu_deserialized = FinishedPduReader::from_bytes(&finished_pdu_vec).unwrap(); assert_eq!(finished_pdu_deserialized, finished_pdu); } - - #[test] - #[cfg(feature = "serde")] - fn test_finished_serialization_serde() { - let finished_pdu = generic_finished_pdu( - CrcFlag::NoCrc, - LargeFileFlag::Normal, - DeliveryCode::Complete, - FileStatus::Retained, - ); - - let output = to_allocvec(&finished_pdu).unwrap(); - let output_converted_back: FinishedPduCreator = from_bytes(&output).unwrap(); - assert_eq!(output_converted_back, finished_pdu); - } } diff --git a/src/cfdp/tlv/mod.rs b/src/cfdp/tlv/mod.rs index 96cb2b8..685098d 100644 --- a/src/cfdp/tlv/mod.rs +++ b/src/cfdp/tlv/mod.rs @@ -42,7 +42,7 @@ pub trait GenericTlv { pub trait WritableTlv { fn write_to_bytes(&self, buf: &mut [u8]) -> Result; fn len_written(&self) -> usize; - #[cfg(feautre = "alloc")] + #[cfg(feature = "alloc")] fn to_vec(&self) -> Vec { let mut buf = vec![0; self.len_written()]; self.write_to_bytes(&mut buf).unwrap();