Repository: eclipse-zenoh-flow/zenoh-flow (language: rust)

Issue:
cargo zenoh-flow boilerplate is broken
After #20 the templates used by `cargo zenoh-flow` are not aligned.
So the build fails


Discussion / hints:

Fix patch:
diff --git a/cargo-zenoh-flow/src/templates.rs b/cargo-zenoh-flow/src/templates.rs
index 1eea8cd6..38db819c 100644
--- a/cargo-zenoh-flow/src/templates.rs
+++ b/cargo-zenoh-flow/src/templates.rs
@@ -70,7 +70,7 @@ use std::collections::HashMap;
 use zenoh_flow::zenoh_flow_derive::ZFState;
 use zenoh_flow::\{
     default_input_rule, default_output_rule, downcast_mut, get_input, zf_data, Component,
-    InputRule, ComponentOutput,OutputRule, Data, Operator,
+    InputRule, ComponentOutput,OutputRule, SerDeData, Operator,
     ZFResult, State, PortId
 };
 
@@ -86,7 +86,7 @@ impl Operator for {name} \{
         _context: &mut zenoh_flow::Context,
         state: &mut Box<dyn zenoh_flow::State>,
         inputs: &mut HashMap<PortId, zenoh_flow::runtime::message::DataMessage>,
-    ) -> ZFResult<HashMap<PortId, Arc<dyn Data>>> \{
+    ) -> ZFResult<HashMap<PortId, SerDeData>> \{
         todo!()
     }
 }
@@ -107,7 +107,7 @@ impl OutputRule for {name} \{
         &self,
         _context: &mut zenoh_flow::Context,
         state: &mut Box<dyn zenoh_flow::State>,
-        outputs: HashMap<PortId, Arc<dyn Data>>,
+        outputs: HashMap<PortId, SerDeData>,
     ) -> ZFResult<HashMap<PortId, ComponentOutput>> \{
         default_output_rule(state, outputs)
     }
@@ -141,7 +141,7 @@ use async_trait::async_trait;
 use std::collections::HashMap;
 use zenoh_flow::zenoh_flow_derive::ZFState;
 use zenoh_flow::\{
-    default_output_rule, downcast_mut, zf_data, Component, ComponentOutput, OutputRule, Data, Source,
+    default_output_rule, downcast_mut, zf_data, Component, ComponentOutput, OutputRule, SerDeData, Source,
     ZFResult, State, PortId
 };
 
@@ -157,7 +157,7 @@ impl Source for {name} \{
         &self,
         _context: &mut zenoh_flow::Context,
         state: &mut Box<dyn zenoh_flow::State>,
-    ) -> ZFResult<HashMap<PortId, Arc<dyn Data>>> \{
+    ) -> ZFResult<HashMap<PortId, SerDeData>> \{
         todo!()
     }
 }
@@ -168,7 +168,7 @@ impl OutputRule for {name} \{
         &self,
         _context: &mut zenoh_flow::Context,
         state: &mut Box<dyn zenoh_flow::State>,
-        outputs: HashMap<PortId, Arc<dyn Data>>,
+        outputs: HashMap<PortId, SerDeData>,
     ) -> ZFResult<HashMap<PortId, ComponentOutput>> \{
         default_output_rule(state, outputs)
     }
@@ -203,7 +203,7 @@ use std::collections::HashMap;
 use zenoh_flow::zenoh_flow_derive::ZFState;
 use zenoh_flow::\{
     default_input_rule, downcast_mut, get_input, Component,
-    InputRule, Data, Sink,
+    InputRule, SerDeData, Sink,
     ZFResult, State, PortId
 };
 
diff --git a/zenoh-flow/src/macros.rs b/zenoh-flow/src/macros.rs
index 7ae81393..5dcecfd8 100644
--- a/zenoh-flow/src/macros.rs
+++ b/zenoh-flow/src/macros.rs
@@ -160,9 +160,10 @@ macro_rules! get_input_raw {
     ($index : expr, $map : expr) => {
         match $map.remove::<str>(&$index) {
             Some(data_message) => match data_message.data {
-                zenoh_flow::SerDeData::Deserialized(_) => {
-                    Err(zenoh_flow::types::ZFError::InvalidData($index))
-                }
+                zenoh_flow::SerDeData::Deserialized(de) => match de.try_serialize() {
+                    Ok(ser) => Ok((data_message.timestamp.clone(), ser)),
+                    Err(e) => Err(e),
+                },
                 zenoh_flow::SerDeData::Serialized(mut ser) => {
                     match zenoh_flow::async_std::sync::Arc::try_unwrap(ser) {
                         Ok(ser) => Ok((data_message.timestamp.clone(), ser)),


Test patch: