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_` is an enum variant that used to be called `Declaration`, but had to be renamed relatively recently when variants started taking up a name in the type namespace, to avoid colliding with the `Declaration` struct.

http://doc.servo.org/cssparser/ast/enum.DeclarationListItem.html#variant.Declaration_

http://doc.servo.org/cssparser/ast/struct.Declaration.html

https://github.com/rust-lang/rfcs/blob/master/text/0234-variants-namespace.md


as if `item` matches the result of any function starting with
Declaration and with any suffix

In patterns, the syntax `Foo(..)` indicates enum variants or tuple-like structs, not arbitrary functions.


I can't seem to find where Declaration is defined, where `mportant`
comes from

As Josh mentioned, the rustdoc documentation for Servo, all its dependencies, and the Rust version we’re using is at http://doc.servo.org/ . They can be search with the bar at the top, or with an URL like http://doc.servo.org/servo/?search=foo

--
Simon Sapin
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to