-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 as_bytes()
for FromUtf8Error
.
#40290
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (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. |
Should I have to add a stability attribute? If yes - which one? |
cc @SimonSapin |
Seems reasonable to me, thanks @3Hren! Also yeah in terms of library stability this'll start out with an |
Ping @3Hren, this is just waiting on the |
@aturon sorry, completely forgot about this PR :(. |
@3Hren Thanks! Note the Travis failure, which is legit. |
Oh, looks like there is a new linter.
How can I fix this? |
cc @rust-lang/docs, can you spell out the procedure here? |
Add a new file in this directory corresponding to name of the unstable feature and then just link to it from the summary file. I plan to add a little README in https://github.com/rust-lang/rust/blob/master/src/doc/usntable-book/ soon describing this. |
@3Hren You'll also need to link to that new page from the summary file. |
Finally, random travis errors non-associated with the PR :) |
Can you remove the merge commit and force push? That'll both clean up the history and restart Travis. |
This change allows to obtain an underlying invalid UTF-8 bytes without `FromUtf8Error` destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction.
Done. |
Error looks spurious.
|
src/doc/unstable-book/src/SUMMARY.md
Outdated
@@ -78,6 +78,8 @@ | |||
- [fmt_internals](fmt-internals.md) | |||
- [fn_traits](fn-traits.md) | |||
- [fnbox](fnbox.md) | |||
- [field_init_shorthand](field-init-shorthand.md) |
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.
Is this line supposed to be here? This is causing the 'read only' fail that Travis is encountering
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.
Looks like it landed here due to bad rebase.
Passed! |
Friendly ping for @aturon. |
Huzzah! @bors: r+ |
📌 Commit bbdf190 has been approved by |
Add `as_bytes()` for `FromUtf8Error`. This change allows to obtain an underlying invalid UTF-8 bytes without `FromUtf8Error` destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction. Personally without this change I ended with `Result<String, (Vec<u8>, Utf8Error)`, which almost copies the functionality of `FromUtf8Error`, but allows immutable view access.
This will avoid obscure Travis CI error messages: * rust-lang#40290 (comment) Original mdbook issue: * https://github.com/azerupi/mdBook/issues/253 mdbook PR: * https://github.com/azerupi/mdBook/pull/254
Bump mdbook dep to pick up new 'create missing' toggle feature. This will avoid obscure Travis CI error messages: * rust-lang#40290 (comment) Original mdbook issue: * https://github.com/azerupi/mdBook/issues/253 mdbook PR: * https://github.com/azerupi/mdBook/pull/254
This change allows to obtain an underlying invalid UTF-8 bytes without
FromUtf8Error
destruction. Such method may be useful for example in a library that attempts to save both valid and invalid UTF-8 strings in some struct and to be able to provide immutable access to it without destruction.Personally without this change I ended with
Result<String, (Vec<u8>, Utf8Error)
, which almost copies the functionality ofFromUtf8Error
, but allows immutable view access.