Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable auto filling of encoding based on type information #812

Open
Mallets opened this issue Mar 12, 2024 · 0 comments
Open

Enable auto filling of encoding based on type information #812

Mallets opened this issue Mar 12, 2024 · 0 comments
Labels
new feature Something new is needed

Comments

@Mallets
Copy link
Member

Mallets commented Mar 12, 2024

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 #764.

@Mallets Mallets added the new feature Something new is needed label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Something new is needed
Projects
None yet
Development

No branches or pull requests

1 participant