Convenient operations for Selector
Following discussion stated in https://github.com/eclipse-zenoh/zenoh/pull/82#issuecomment-822432476
Alternatively, we can provide explicit methods to help users to modify the selector. It looks like this.
use zenoh as z; let selector = z::selector("/a/b").add_predicate("x=3&y=4").join("c"); // "/a/b/c?x=3&y=4"
predicate is a zenoh-net abstraction that is passed with a resource key on query. I think we shall not use it with Selector.
But we could add those functions:
- with_filter()
- with_properties()
- with_fragment()
I don't feel join() being explicit enough. Maybe join_to_path_expr() ?
But I still think if one wants to update the path expression of a Selector, he should call a function on selector.path_expr.
@jerry73204 What's your opinion ?
I prefer exposing a mutable reference to underlying pathexpr, leaving it to the user. There's no need to delegate path methods on selector.
@JEnoch is this issue still open or it has been addressed by the new 0.6.0-dev API?
This issue as not been addressed by the new API.
Moreover all convenient operations that were introduced in #82 have been removed, in favor of new KeyExpr and Selector implementations that make usage of Cow<'a, str> (to avoid strings manipulations/clones) and that no longer check the string syntax (for performances reasons).