From 9166faa4ae92d53c85c6cc86a2dfe65303d9ee7f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 19 Jul 2024 11:29:37 -0700 Subject: [PATCH] optimization --- src/cfdp/pdu/file_data.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cfdp/pdu/file_data.rs b/src/cfdp/pdu/file_data.rs index 94642c1..1d3025b 100644 --- a/src/cfdp/pdu/file_data.rs +++ b/src/cfdp/pdu/file_data.rs @@ -398,13 +398,16 @@ impl FileDataPduCreatorWithUnwrittenData<'_> { } /// This functio needs to be called to add a CRC to the file data PDU where applicable. - pub fn finish(self) { + /// + /// It returns the full written size of the PDU. + pub fn finish(self) -> usize { if self.needs_crc { add_pdu_crc( self.write_buf, self.file_data_offset as usize + self.file_data_len as usize, ); } + self.write_buf.len() } }