Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

&str

Também conhecido como string slice ou fatia de string, representa uma referência imutável a uma sequência de texto UTF-8. É usado como string sem a necessidade de alocar memória no heap.

&str

#![allow(unused)]
fn main() {
let cria_str: &str = "Pequeno texto!";
println!("{}", cria_str);
}
#![allow(unused)]
fn main() {
let cria_str = "Outro pequeno texto!";
println!("{}", cria_str);
}