I realize Rust is in flux, but I'm trying to learn it anyway. I'm trying to understand how I would adapt the following example, which works with 0.9, into something similar that works with 0.10:
fn main() {
let argv = std::os::args();
let (first, last) = match argv {
[_, first_arg, .., last_arg] => (first_arg, last_arg),
_ => fail!("Error: At least two arguments expected.")
};
println!("The first argument was {:s}, \
and the last argument was {:s}.", first, last);
}
When I build this with 0.10, I get the following error:
error: couldn't read test.rc: no such file or directory (No such file or directory)
orflongpmacx8:rust pohl_longsine$ rustc test.rs
test.rs:9:9: 9:37 error: unique vector patterns are no longer supported
test.rs:9 [_, first_arg, .., last_arg] => (first_arg, last_arg),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
My question: is it still possible to use pattern matching on argv, but with different syntax, or is using a match statement on argv no longer possible at all? If it's the former, what would I have to change?