From 05d3bac927b3d3d5f55e7b055b489f88a83f3834 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Nov 2024 15:46:42 +0100 Subject: [PATCH] Add back API which was deleted accidently --- src/cfdp/tlv/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cfdp/tlv/mod.rs b/src/cfdp/tlv/mod.rs index bb4973d..4826438 100644 --- a/src/cfdp/tlv/mod.rs +++ b/src/cfdp/tlv/mod.rs @@ -273,6 +273,15 @@ pub mod alloc_mod { data: Vec::new(), } } + + pub fn as_tlv(&self) -> Tlv<'_> { + Tlv { + tlv_type_field: self.tlv_type_field, + // The API should ensure that the data length is never to large, so the unwrap for the + // LV creation should never be an issue. + lv: Lv::new(&self.data).expect("lv creation failed unexpectedly"), + } + } } impl ReadableTlv for TlvOwned {