Skip to content
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

str::into_boxed_bytes should have a doc example #44423

Closed
frewsxcv opened this issue Sep 8, 2017 · 3 comments
Closed

str::into_boxed_bytes should have a doc example #44423

frewsxcv opened this issue Sep 8, 2017 · 3 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority

Comments

@frewsxcv
Copy link
Member

frewsxcv commented Sep 8, 2017

https://doc.rust-lang.org/nightly/std/primitive.str.html#method.into_boxed_bytes

If anyone anyone wants to work on this, just mention it in a comment to prevent duplicate work. If you need any help or have any questions, don't hesitate to ping me :)

@frewsxcv frewsxcv added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Sep 8, 2017
@alexcrichton alexcrichton added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Sep 8, 2017
@42triangles
Copy link

42triangles commented Sep 9, 2017

I'd like to do it. Would something like

let s = "this is a string";
let boxed = s.to_owned().into_boxed_str().into_boxed_bytes();
assert_eq!(*boxed, *s.as_bytes());

suffice?

Should I split the boxed declaration into two (-> let boxed_str = s.to_owned().into_boxed_str(); and let boxed_u8_slice = boxed_str.into_bytes(); maybe with type information attached)?

@frewsxcv
Copy link
Member Author

@42triangles yep, that looks good to me! if you want to separate it into multiple declarations, go for it. most doc examples don't have the type information explicitly attached, but if you think it helps understand the API, then feel free to incorporate it.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 13, 2017
Added an example for `std::str::into_boxed_bytes()`

This solves issue rust-lang#44423.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Sep 14, 2017
Added an example for `std::str::into_boxed_bytes()`

This solves issue rust-lang#44423.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Sep 15, 2017
Added an example for `std::str::into_boxed_bytes()`

This solves issue rust-lang#44423.
@frewsxcv
Copy link
Member Author

Resolved in #44485

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 C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority
Projects
None yet
Development

No branches or pull requests

3 participants