zenoh
zenoh copied to clipboard
zenoh-ext serialization and deserialization for structs with serde support
Describe the feature
There seems to be considerable overlap between the Serialize / Deserialize traits in zenoh-ext and the same traits in the serde crate. If it were possible to add a feature flag to zenoh-ext that provides an adapter so that anything with the Serialize / Deserialize traits in serde can be converted into ZBytes with the zenoh serialization protocol, it would make zenoh much more accessible for data structures in the broader Rust ecosystem.
I'm not sure if there's any fundamental incompatibility between what's needed by the serialization/deserialization of zenoh-ext versus serde. Here's one approach that comes to mind for me:
-
zenoh-extcan provide structs that implement theserde::ser::Serializerandserde::Deserializertraits. These traits would convert to/fromZBytesencoded in the zenoh protocol. - If there are data types supported by serde which aren't supported by the zenoh protocol, then the serializer/deserializer can return an
Err - If there are data types supported by the zenoh protocol that aren't covered by serde, then that data just goes unused when being handled by serde