-
Notifications
You must be signed in to change notification settings - Fork 13k
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 Utf8Error::error_len, to help incremental and/or lossy decoding. #40212
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This is a new standard library public API that I’m hoping to stabilize eventually. But it’s a small extension of an existing feature rather than an entirely new feature, so it seemed appropriate to submit without an RFC. |
This seems reasonable to me and I agree that an RFC isn't necessary. cc @rust-lang/libs @rfcbot fcp merge |
Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
☔ The latest upstream changes (presumably #40189) made this pull request unmergeable. Please resolve the merge conflicts. |
3e1601a
to
7e95d5b
Compare
Rebased. |
5ea9b0e
to
354f092
Compare
After trying it I’ve pushed another commit to change the proposed API:
re r? @BurntSushi @Kimundi @alexcrichton @aturon @brson @sfackler |
Seems fine by me! |
@bors: r+ |
📌 Commit 354f092 has been approved by |
Added a tracking issue number to the PR. @aturon re-r? |
@bors: r=aturon |
📌 Commit 5b3dbd8 has been approved by |
🔒 Merge conflict |
Without this, code outside of the standard library needs to reimplement most of the logic `from_utf8` to interpret the bytes after `valid_up_to()`.
Their relationship is: * `resume_from = error_len.map(|l| l + valid_up_to)` * error_len is always one of None, Some(1), Some(2), or Some(3). When I started using resume_from I almost always ended up subtracting valid_up_to to obtain error_len. Therefore the latter is what should be provided in the first place.
5b3dbd8
to
73370c5
Compare
Rebased. I don’t understand how this happened, but git seemed convinced that my commits wanted to remove the @aturon or @alexcrichton r? |
~submodules~ @bors: r=aturon |
📌 Commit 73370c5 has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 73370c5 has been approved by |
⌛ Testing commit 73370c5 with merge ae118b1... |
@bors retry |
Add Utf8Error::error_len, to help incremental and/or lossy decoding. Without this, code outside of the standard library needs to reimplement most of the logic `from_utf8` to interpret the bytes after `valid_up_to()`.
☀️ Test successful - status-appveyor, status-travis |
Without this, code outside of the standard library needs to reimplement most of the logic
from_utf8
to interpret the bytes aftervalid_up_to()
.