On 24/10/14 17:19, Gilles Leblanc wrote:
Declaration_(Declaration{ location: l, name: n, value: v, important: i}) =>
{
The code is doing some pattern matching. `_` normally matches against every
other case.
`_` here is part of the `Declaration_` name, not a pattern of its own.
`Declaration_`
This is an example of the lengths to which pattern matching can be taken
in Rust. There's an enum variant named Declaration_ which contains a
value of type Declaration. The code you quoted is equivalent to the
following:
Declaration_(decl) => {
let l = decl.location;
let n = decl.name;
l
2 matches
Mail list logo