fn main() { let s = String::from("hello dj"); //字符串字面值实际就是字符串的切片,所以 let ss ="hello dj"; //&s[..]其实等价于ss let s1 = first_word(&s[..]); println!("s1 is {}",s1); let s2 = first_word(ss); println!("s2 is {}",s2);…
一路看过来,怕是我知道的所有语言当,处理最复杂吧. 当然,如果能正确处理,也是能理解最到位的. 这,就是我为什么要学Rust的原因. 暂无用武之地,但逻辑体系和知识点够复杂,才能应对更多事务~ fn main() { let s1 = String::from("tic"); let s2 = String::from("tac"); let s3 = String::from("toe"); let s = format!("{}-{…