fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1#[derive(Copy, Clone)] 2struct HasChars; 3 4impl HasChars { 5 fn chars(self) -> std::str::Chars<'static> { 6 "HasChars".chars() 7 } 8} 9 10fn main() { 11 let abc = "abc"; 12 let def = String::from("def"); 13 let mut s = String::new(); 14 15 s.push_str(abc); 16 s.push_str(abc); 17 18 s.push_str("abc"); 19 s.push_str("abc"); 20 21 s.push_str(&def); 22 s.push_str(&def); 23 24 s.extend(abc.chars().skip(1)); 25 s.extend("abc".chars().skip(1)); 26 s.extend(['a', 'b', 'c'].iter()); 27 28 let f = HasChars; 29 s.extend(f.chars()); 30 31 // issue #9735 32 s.push_str(&abc[0..2]); 33}