published: 16th of February 2022
There are two "mainly used" string types in Rust. The str slice, which is mostly seen as a borrowed &str slice. And the errm ... String . Wait ... Wut?
// Create a `borrowed string`.
let stuff = "stuff";
// Create a `borrowed string` and annotate the type.
let stuff: &str = "stuff";
// Create a `String`.
let things = "things".to_string();
let things = String::from("things");
// Create a `String` and annotate the type.
let things: String = "things".to_string();
let things: String = String::from("things");
https://www.manning.com/books/rust-in-action
https://www.udemy.com/course/ultimate-rust-crash-course/
https://doc.rust-lang.org/std/primitive.str.html