Improve documentation about string and str


#1

One of the most talked topics about rust are strings. Why? Because they are complicated to use? Well at least more complicated than in other languages, but one big reason is, that there is a big lack in documentation. Neither the rust book nor the API mention for example these details:

String (the “owned” sort of string type) is a wrapper for a heap-allocated buffer of unicode bytes. str (the “slice” sort of string type) is a buffer of unicode bytes that may be on the stack, on the heap, or in the program memory itself.

From https://andrewbrinker.github.io/blog/2016/03/27/string-types-in-rust/

Also the chapter “Why “Owned” Strings Exist” is interesting.

The situation about ownership in rust is similar. You find better explanations and examples in the internet than in the book itself.

My question is, why these important topics don’t get more clarified in the book? There are many examples what can be done better. There is also the possibility to contact blogger whether it is possible to take over some parts of their tutorial.

Best regards,

Stefano


#2

Mostly: Time, effort, editing, only one person working on all the things including the tech and the whole stdlib docs. PRs happily welcome, they will be worked on quickly.

We do. Sometimes blog posts become chapters.


#3

Hey, author of the referenced blog post here. I am happy to contribute to the Rust docs, and have been meaning to do more to contribute to Rust in general. It’s just been a question of time.

I’m on vacation right now, but I am happy to start making some pull requests with potential improvements after that.


#4

Also, I am working on the second draft of the book, and it literally covers ownership and borrowing through a deep dive with String and&str. So we’ll get there!


#5

Is there any ETA of the new book? I’m eager to read it!


#6

https://github.com/rust-lang/book is the repo. The start is the hardest part, so I’ve spent a lot of time on it. Hoping to get more done soon. Closest I’m willing to give as an ETA is “a few months”