mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Derive ToComputedValue
For now, only impls for types like in style::values::generics can be derived. This also needed a few ToComputedValueAsSpecified impls that I would like to replace by some #[to_computed_value(clone)] attribute, but I think it is ok to keep it like this for now.
This commit is contained in:
parent
a99e73ba6b
commit
07c0456cfd
7 changed files with 247 additions and 422 deletions
|
@ -10,9 +10,16 @@ extern crate synstructure;
|
|||
use proc_macro::TokenStream;
|
||||
|
||||
mod has_viewport_percentage;
|
||||
mod to_computed_value;
|
||||
|
||||
#[proc_macro_derive(HasViewportPercentage)]
|
||||
pub fn derive_has_viewport_percentage(stream: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||
has_viewport_percentage::derive(input).to_string().parse().unwrap()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(ToComputedValue)]
|
||||
pub fn derive_to_computed_value(stream: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||
to_computed_value::derive(input).to_string().parse().unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue