style: Add a ValueInfo trait for exposing types needed by devtools.

Most of types just derive it using proc_macro directly. Some of value
types need manual impl.

In my current plan, this new trait will be used in bug 1434130 to expose
values as well.

Bug: 1455576
Reviewed-by: emilio
MozReview-Commit-ID: LI7fy45VkRw
This commit is contained in:
Xidorn Quan 2018-04-26 09:01:02 +10:00 committed by Emilio Cobos Álvarez
parent 276fb7e04b
commit 7fe7b2ffb1
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
66 changed files with 615 additions and 249 deletions

View file

@ -188,7 +188,7 @@ where
}
}
pub fn parse_variant_attrs<A>(variant: &VariantAst) -> A
pub fn parse_variant_attrs_from_ast<A>(variant: &VariantAst) -> A
where
A: FromVariant,
{
@ -198,7 +198,14 @@ where
fields: variant.fields.clone(),
discriminant: variant.discriminant.clone(),
};
match A::from_variant(&v) {
parse_variant_attrs(&v)
}
pub fn parse_variant_attrs<A>(variant: &Variant) -> A
where
A: FromVariant
{
match A::from_variant(variant) {
Ok(attrs) => attrs,
Err(e) => panic!("failed to parse variant attributes: {}", e),
}