-
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
Help people find String::as_bytes() for UTF-8 #39688
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
Comments
This is the way I'd want to go; I'm working with @jdhorwitz on this. (well, i was, then he left irc. @jdhorowitz happy to work through things here, or just ping me whenever 😄 ) |
jdhorwitz
added a commit
to jdhorwitz/rust
that referenced
this issue
Mar 3, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Mar 3, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
jdhorwitz
added a commit
to jdhorwitz/rust
that referenced
this issue
Mar 4, 2017
bors
added a commit
that referenced
this issue
Mar 4, 2017
Issue #39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
bors
added a commit
that referenced
this issue
Mar 5, 2017
Issue #39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
jdhorwitz
added a commit
to jdhorwitz/rust
that referenced
this issue
Mar 6, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Mar 6, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Mar 6, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Mar 7, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Mar 8, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this issue
Mar 8, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
arielb1
pushed a commit
to arielb1/rust
that referenced
this issue
Mar 8, 2017
Issue rust-lang#39688 - Help people find String::as_bytes() for UTF-8 Added in links for the inverse functions so people will know that as_bytes() is the inverse of from_utf8() and vice versa. ?r @steveklabnik
steveklabnik
added
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
and removed
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
labels
Mar 10, 2017
#40226 was merged, closing! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
Previous discussion:
#14131
#17438
Still a minor thing, so probably not worth an RFC.
as_bytes()
is a fine name, but the function is not easy to discover. I have video evidence of Rust beginners who know and usefrom_utf8()
, but can't find the inverse, which isas_bytes()
. The documentation provides no links between the two.Possible mitigations (could even apply multiple of these):
.as_utf8()
or.to_utf8()
, and.into_utf8()
and mention in the documentation that it's simply an alias..as_bytes()
and friends, so it can at least be found through search engines. Currently, queries for "rust string to utf8" or "rust utf8 bytes from string" only take you to thefrom_utf8()
function, which works the wrong way round..as_bytes()
and.from_utf8()
from each other and mention that they are (roughly) inverses (modulo error handling, modulo ownership stuff).Currently, http://stackoverflow.com/questions/27195506/convert-an-ascii-string-literal-to-u8-in-rust#comment42877192_27195762 might be the hint that helps most people discover
as_bytes()
.The text was updated successfully, but these errors were encountered: