mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Derive the most trivial ToCss implementations 🌋
For now, all variants get serialised as the space-separated serialisations of their fields. Unit variants are not supported.
This commit is contained in:
parent
6d6f03974d
commit
c4f1d647a0
18 changed files with 113 additions and 263 deletions
|
@ -11,6 +11,7 @@ use proc_macro::TokenStream;
|
|||
|
||||
mod has_viewport_percentage;
|
||||
mod to_computed_value;
|
||||
mod to_css;
|
||||
|
||||
#[proc_macro_derive(HasViewportPercentage)]
|
||||
pub fn derive_has_viewport_percentage(stream: TokenStream) -> TokenStream {
|
||||
|
@ -23,3 +24,9 @@ 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()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(ToCss)]
|
||||
pub fn derive_to_css(stream: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||
to_css::derive(input).to_string().parse().unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue