想要连接一个字符串。这不应该引起某种恐慌或编译错误吗?
let mut s=String::from("abc").push_str("x"); println!("{:?}",s); // Prints ()
但这行得通:
let mut s=String::from("abc"); s.push_str("x"); println!("{:?}",s); // Prints "abcx"
push_str
()
pub fn push_str(&mut self, string: &str)