-
Notifications
You must be signed in to change notification settings - Fork 552
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
transform-sdk/cpp: add string_view conversion from bytes_view #17249
Conversation
This will probably be a common operation, so make it easier for users. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
If you want to abort use the abort function. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
041e69c
to
a5f9f98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
.transform([](bytes_view buf) { | ||
return std::string_view{buf}; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't know how I missed this in the first round of CR but 🔥 🔥 🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional<T>::transform
I mean. so good
@@ -424,6 +420,10 @@ bytes::value_type bytes_view::operator[](size_t n) const { return _start[n]; } | |||
bool bytes_view::operator==(const bytes_view& other) const { | |||
return std::ranges::equal(*this, other); | |||
} | |||
bytes_view::operator std::string_view() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: looks like you're using this explicit
...should it be declared so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No explicit doesn't take place in overlod resolution and it's only allowed at declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it is declared explicit. My mistake. Thought I was looking at the declaration right here 👍
A small QoL improvement for the C++ SDK.
Backports Required
Release Notes