feat: accept TryInto<KeyExpr> in SampleBuilder::put and ::delete#2508
Open
varunkamath wants to merge 1 commit into
Open
feat: accept TryInto<KeyExpr> in SampleBuilder::put and ::delete#2508varunkamath wants to merge 1 commit into
TryInto<KeyExpr> in SampleBuilder::put and ::delete#2508varunkamath wants to merge 1 commit into
Conversation
`SampleBuilder::put` and `SampleBuilder::delete` now accept `TryInto<KeyExpr<'static>>` instead of `Into<KeyExpr<'static>>`, allowing `&str` to be passed directly without manual conversion. This is a non-breaking change: existing code using `Into<KeyExpr>` types continues to work since `Into<T>` implies `TryInto<T>`. Fixes eclipse-zenoh#2172 Signed-off-by: Varun Kamath <varunkamath@gmail.com> Signed-off-by: Varun Kamath <varun.kamath@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What does this PR do?
Changes
SampleBuilder::putandSampleBuilder::deleteto acceptTryInto<KeyExpr<'static>>instead ofInto<KeyExpr<'static>>, so&strcan be used directly:Why is this change needed?
The current API is unnecessarily restrictive. Other
SampleBuilderconstructors already accept fallible conversions, and requiring users to manually convert&str→KeyExpris inconvenient. This is a non-breaking change sinceInto<T>impliesTryInto<T>, so all existing call sites continue to compile.Related Issues
Fixes #2172
🏷️ Label-Based Checklist
No specific label requirements detected.
Current labels: No labels
Add one of these labels to this PR to see relevant checklist items:
api-sync,breaking-change,bug,ci,dependencies,documentation,enhancement,new feature,internalThis section updates automatically when labels change.