Last active: 6 months ago
rust at operator binding
fn main() {
let strs = ["hello world", "1", "hello", "world"];
let mut remaining: &[&str] = &strs;
while let [current, tail @ ..] = remaining {
println!("{} - {:?}", current, tail);
remaining = tail;
}
println!("The real strs {:?}", strs);
}