mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
style: Factor out some of style_derive.
Differential Revision: https://phabricator.services.mozilla.com/D17188
This commit is contained in:
parent
f581d2afb2
commit
d8a758272e
13 changed files with 40 additions and 9 deletions
16
components/derive_common/Cargo.toml
Normal file
16
components/derive_common/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "derive_common"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
license = "MPL-2.0"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
darling = "0.8"
|
||||
proc-macro2 = "0.4"
|
||||
quote = "0.6"
|
||||
syn = { version = "0.15", features = ["visit"] }
|
||||
synstructure = "0.10"
|
14
components/derive_common/lib.rs
Normal file
14
components/derive_common/lib.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* 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/. */
|
||||
|
||||
extern crate darling;
|
||||
extern crate proc_macro;
|
||||
extern crate proc_macro2;
|
||||
#[macro_use]
|
||||
extern crate quote;
|
||||
#[macro_use]
|
||||
extern crate syn;
|
||||
extern crate synstructure;
|
||||
|
||||
pub mod cg;
|
|
@ -11,6 +11,7 @@ proc-macro = true
|
|||
|
||||
[dependencies]
|
||||
darling = "0.8"
|
||||
derive_common = { path = "../derive_common" }
|
||||
proc-macro2 = "0.4"
|
||||
quote = "0.6"
|
||||
syn = { version = "0.15", features = ["visit"] }
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
use crate::cg;
|
||||
use darling::util::IdentList;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::TokenStreamExt;
|
||||
use syn::{DeriveInput, Path, WhereClause};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
||||
use crate::cg;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::TokenStreamExt;
|
||||
use syn::{DeriveInput, Path};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate darling;
|
||||
extern crate derive_common;
|
||||
extern crate proc_macro;
|
||||
extern crate proc_macro2;
|
||||
#[macro_use]
|
||||
|
@ -17,7 +18,6 @@ extern crate synstructure;
|
|||
use proc_macro::TokenStream;
|
||||
|
||||
mod animate;
|
||||
mod cg;
|
||||
mod compute_squared_distance;
|
||||
mod parse;
|
||||
mod specified_value_info;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
use crate::cg;
|
||||
use crate::to_css::CssVariantAttrs;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::TokenStream;
|
||||
use syn::{self, DeriveInput, Path};
|
||||
use synstructure::{Structure, VariantInfo};
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* 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/. */
|
||||
|
||||
use crate::cg;
|
||||
use crate::parse::ParseVariantAttrs;
|
||||
use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
|
||||
use derive_common::cg;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::TokenStreamExt;
|
||||
use syn::{Data, DeriveInput, Fields, Ident, Type};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
use crate::cg;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::{Span, TokenStream};
|
||||
use syn::{DeriveInput, Ident};
|
||||
use synstructure::BindStyle;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
||||
use crate::cg;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::TokenStreamExt;
|
||||
use syn;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
use crate::cg;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::{Span, TokenStream};
|
||||
use syn::{DeriveInput, Ident};
|
||||
use synstructure::BindStyle;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
use crate::cg;
|
||||
use darling::util::Override;
|
||||
use derive_common::cg;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{ToTokens, TokenStreamExt};
|
||||
use syn::{self, Data, Path, WhereClause};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue