zenoh
zenoh copied to clipboard
Enable auto filling of encoding based on type information
Describe the feature
Provide encoding::auto for automatic encoding selection based on the information from the type system.
I.e.: the feature would allow to have a publisher with auto encoding and any following put() will automatically set the right encoding.
Desired behaviour:
let pub = session.declare_publisher("foo/test").with_encoding("auto").res().await.unwrap();
pub.put(1).res().await.unwrap();
pub.put(-1).res().await.unwrap();
pub.put(1.01).res().await.unwrap();
pub.put("mystring").res().await.unwrap();
Equivalent to existing behaviour:
let pub = session.declare_publisher("foo/test").res().await.unwrap();
pub.put(1).with_encoding("zenoh/uint").res().await.unwrap();
pub.put(-1).with_encoding("zenoh/int").res().await.unwrap();
pub.put(1.01).with_encoding("zenoh/float").res().await.unwrap();
pub.put("mystring").with_encoding("zenoh/string").res().await.unwrap();
More information about the reworked encoding can be found in https://github.com/eclipse-zenoh/zenoh/pull/764.