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
Add convenience TextEncoder functions to encode directly to string #402
Conversation
b73f78e
to
062224b
Compare
Thanks for PR. Looks great overall, I've left a couple of minor comments in review. |
Figured out a much better solution -- there's no need for unsafety here. |
Ok, #403 is merged so rebasing this PR now should make the CI happy. |
@zhouqiang-cl @BusyJay @breeswish whoever of you has access to do that, can you please tweak the workflow permissions as shown in #402 (comment) so that we don't have to re-approve it on every push? |
As github actions resource are bound to the organization account, so it might not be a good idea to just change it for a repository. Maybe you can send an issue to tikv/community or a thread at https://internals.tidb.io/, let's discuss it more! |
Signed-off-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Signed-off-by: Aleksey Kladov <aleksey.kladov@gmail.com>
@lucab ptal :) |
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.
LGTM, thanks!
…ikv#402) * Convenience TextEncoder functions for working with strings Signed-off-by: Aleksey Kladov <aleksey.kladov@gmail.com> * Avoid accidentally quadratic issue in TextEncoder::encode_utf8 Signed-off-by: Aleksey Kladov <aleksey.kladov@gmail.com> Signed-off-by: Jan Berktold <jberktold@roblox.com>
I saw that we do
a bunch of times in near and figured that the library can probably guaranty utf8 validity and remove the need for one unwrap here.
This turned out to be slightly more involved then I've thought, as there's no standard way to explain that you'll only write utf8 to a
Write
, but it wasn't to hard either.As a bonus,
TextEncoder
impl now is statically guaranteed to produce only valid utf8