Re: [dev-servo] Question about a certain line of code in Servo

2014-10-24 Thread Simon Sapin
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_`

Re: [dev-servo] Question about a certain line of code in Servo

2014-10-24 Thread Josh Matthews
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