mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Allow deriving Parse for keywords.
This commit is contained in:
parent
da3dd05ff9
commit
7036cb0077
5 changed files with 126 additions and 38 deletions
|
@ -2,6 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
#[macro_use] extern crate darling;
|
||||
extern crate proc_macro;
|
||||
#[macro_use] extern crate quote;
|
||||
|
@ -13,6 +15,7 @@ use proc_macro::TokenStream;
|
|||
mod animate;
|
||||
mod cg;
|
||||
mod compute_squared_distance;
|
||||
mod parse;
|
||||
mod to_animated_value;
|
||||
mod to_animated_zero;
|
||||
mod to_computed_value;
|
||||
|
@ -36,6 +39,12 @@ pub fn derive_to_animated_value(stream: TokenStream) -> TokenStream {
|
|||
to_animated_value::derive(input).to_string().parse().unwrap()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(Parse)]
|
||||
pub fn derive_parse(stream: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||
parse::derive(input).to_string().parse().unwrap()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(ToAnimatedZero, attributes(animation))]
|
||||
pub fn derive_to_animated_zero(stream: TokenStream) -> TokenStream {
|
||||
let input = syn::parse_derive_input(&stream.to_string()).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue