diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /servo/components/style_derive/lib.rs | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style_derive/lib.rs')
-rw-r--r-- | servo/components/style_derive/lib.rs | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/servo/components/style_derive/lib.rs b/servo/components/style_derive/lib.rs new file mode 100644 index 0000000000..079db00c5a --- /dev/null +++ b/servo/components/style_derive/lib.rs @@ -0,0 +1,82 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#![recursion_limit = "128"] + +#[macro_use] +extern crate darling; +extern crate derive_common; +extern crate proc_macro; +extern crate proc_macro2; +#[macro_use] +extern crate quote; +#[macro_use] +extern crate syn; +extern crate synstructure; + +use proc_macro::TokenStream; + +mod animate; +mod compute_squared_distance; +mod parse; +mod specified_value_info; +mod to_animated_value; +mod to_animated_zero; +mod to_computed_value; +mod to_css; +mod to_resolved_value; + +#[proc_macro_derive(Animate, attributes(animate, animation))] +pub fn derive_animate(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + animate::derive(input).into() +} + +#[proc_macro_derive(ComputeSquaredDistance, attributes(animation, distance))] +pub fn derive_compute_squared_distance(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + compute_squared_distance::derive(input).into() +} + +#[proc_macro_derive(ToAnimatedValue)] +pub fn derive_to_animated_value(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + to_animated_value::derive(input).into() +} + +#[proc_macro_derive(Parse, attributes(css, parse))] +pub fn derive_parse(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + parse::derive(input).into() +} + +#[proc_macro_derive(ToAnimatedZero, attributes(animation, zero))] +pub fn derive_to_animated_zero(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + to_animated_zero::derive(input).into() +} + +#[proc_macro_derive(ToComputedValue, attributes(compute))] +pub fn derive_to_computed_value(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + to_computed_value::derive(input).into() +} + +#[proc_macro_derive(ToResolvedValue, attributes(resolve))] +pub fn derive_to_resolved_value(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + to_resolved_value::derive(input).into() +} + +#[proc_macro_derive(ToCss, attributes(css))] +pub fn derive_to_css(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + to_css::derive(input).into() +} + +#[proc_macro_derive(SpecifiedValueInfo, attributes(css, parse, value_info))] +pub fn derive_specified_value_info(stream: TokenStream) -> TokenStream { + let input = syn::parse(stream).unwrap(); + specified_value_info::derive(input).into() +} |