fn main() {
let strVar : &'static str = "str";
let stringVar : String = "String".to_string(); // precisa converter o tipo
teste(strVar);
teste(&stringVar);
}
fn teste(texto: &str) {
println!("Isto é um {}", texto);
}
//https://pt.stackoverflow.com/q/485812/101
Zm4gbWFpbigpIHsKICAgIGxldCBzdHJWYXIgOiAmJ3N0YXRpYyBzdHIgPSAic3RyIjsKICAgIGxldCBzdHJpbmdWYXIgOiBTdHJpbmcgPSAiU3RyaW5nIi50b19zdHJpbmcoKTsgLy8gcHJlY2lzYSBjb252ZXJ0ZXIgbyB0aXBvCiAgICB0ZXN0ZShzdHJWYXIpOwogICAgdGVzdGUoJnN0cmluZ1Zhcik7Cn0KCmZuIHRlc3RlKHRleHRvOiAmc3RyKSB7CiAgICBwcmludGxuISgiSXN0byDDqSB1bSB7fSIsIHRleHRvKTsKfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvNDg1ODEyLzEwMQ==