Skip to content
Select theme

Working with text

Text is where Rust’s honesty about memory shows up first. A String is bytes that are guaranteed to be valid UTF-8, so s[0] cannot work, and s.len() is not a character count.

These are the articles you need when the string will not slice, will not reverse, or has a newline in it you did not see.