leodos_protocols/transport/cfdp/pdu/file_data/
mod.rs1use crate::transport::cfdp::CfdpError;
2
3pub mod with_meta;
5pub mod without_meta;
7
8#[derive(Debug, Clone, Copy)]
10pub enum FileDataPdu<'a> {
11 WithMeta(&'a with_meta::FileDataPduWithMeta),
13 WithoutMeta(&'a without_meta::FileDataPduWithoutMeta),
15}
16
17impl<'a> FileDataPdu<'a> {
18 pub fn file_data(&self, large_file_flag: bool) -> Result<&'a [u8], CfdpError> {
20 match self {
21 FileDataPdu::WithMeta(pdu) => pdu.file_data(large_file_flag),
22 FileDataPdu::WithoutMeta(pdu) => pdu.file_data(large_file_flag),
23 }
24 }
25
26 pub fn offset(&self, large_file_flag: bool) -> Result<u64, CfdpError> {
28 match self {
29 FileDataPdu::WithMeta(pdu) => pdu.offset(large_file_flag),
30 FileDataPdu::WithoutMeta(pdu) => pdu.offset(large_file_flag),
31 }
32 }
33}