In the example match expression from the manual:
enum List<X> { Nil, Cons(X, @List<X>) }
let x: List<int> = Cons(10, @Cons(11, @Nil));
match x {
Cons(a, @Cons(b, _)) => {
process_pair(a,b);
}
Cons(10, _) => {
process_ten();
}
Nil => {
return;
}
_ => {
fail;
}
}
How is rust deciding that "Nil" here would be "matched" rather than "bound" in the third case?
The documentation could probably use a little clarification on this matter, as there could be a number of possible schemes being used. Some of these schemes are discussed in the "bike shed" but none of the proposals there match the syntax in the manual.