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
Wrap prop names into a PropName type offering free conversion to str #780
Merged
Conversation
This file contains 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
Introduce properties::PropName and properties::PropertyName which wrap CStr and CString types respectively with additional requirement that the value is valid UTF-8. This means that the types offer zero-cost conversion into string. Use it with property names in properties module such that the properties can be used with property_value (which was the case before) and also Displayed (which previously required UTF-8 verification or an unsafe block and now can be done safely with zero additional cost). This is API breaking change (since type of objects in properties module change) but the breakage should be easy to deal with (especially since the new types implement CStrLike and thus most common usage of the property names will continue to work).
mina86
changed the title
Wrap props names into a PropName type offering free conversion to str
Wrap prop names into a PropName type offering free conversion to str
May 15, 2023
aleksuss
reviewed
May 26, 2023
aleksuss
reviewed
May 29, 2023
aleksuss
reviewed
May 29, 2023
aleksuss
reviewed
Jul 15, 2023
Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
Clippy failure in unrelated code:
|
aleksuss
approved these changes
Jul 15, 2023
stanislav-tkach
approved these changes
Jul 19, 2023
Friendly ping. ^_^ |
Shylock-Hg
pushed a commit
to Shylock-Hg/rust-rocksdb
that referenced
this pull request
Mar 29, 2024
* librocksdb_sys: prefer tikv/rust-snappy * Fix make Signed-off-by: Neil Shen <overvenus@gmail.com>
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.
Introduce properties::PropName and properties::PropertyName which wrap CStr and CString types respectively with additional requirement that the value is valid UTF-8. This means that the types offer zero-cost conversion into string.
Use it with property names in properties module such that the properties can be used with property_value (which was the case before) and also Displayed (which previously required UTF-8 verification or an unsafe block and now can be done safely with zero additional cost).
This is API breaking change (since type of objects in properties module change) but the breakage should be easy to deal with (especially since the new types implement CStrLike and thus most common usage of the property names will continue to work).
Admittedly this is a substantial amount of code for a relatively insignificant feature.