Hello,
I'm having some problems understanding the following line of code in the
servo codebase:
https://github.com/servo/servo/blob/master/components/style/properties/mod.rs.mako#L1524
Declaration_(Declaration{ location: l, name: n, value: v, important: i}) =>
{
The code is doing some pattern matching. `_` normally matches against every
other case. In this case it's preceded by Declaration which I understand as
if `item` matches the result of any function starting with Declaration and
with any suffix which takes a parameter of type Declaration which is
probably a struct in which we destructure the values localtion, name, value
and important.
I can't seem to find where Declaration is defined, where `mportant` comes
from and I'm really not sure about my interpretation of the meaning of this
line of code.
Any pointers would be appreciated,
Thanks.
Here's the line in context:
match item {
DeclAtRule(rule) => log_css_error(
rule.location, format!("Unsupported at-rule in
declaration list: @{:s}", rule.name).as_slice()),
Declaration_(Declaration{ location: l, name: n, value: v,
important: i}) => {
// TODO: only keep the last valid declaration for a given name.
let (list, seen) = if i {
(&mut important_declarations, &mut important_seen)
} else {
(&mut normal_declarations, &mut normal_seen)
};
_______________________________________________
dev-servo mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-servo