diff options
Diffstat (limited to '')
-rw-r--r-- | third_party/rust/darling_macro/.cargo-checksum.json | 1 | ||||
-rw-r--r-- | third_party/rust/darling_macro/Cargo.toml | 30 | ||||
-rw-r--r-- | third_party/rust/darling_macro/LICENSE | 21 | ||||
-rw-r--r-- | third_party/rust/darling_macro/src/lib.rs | 41 |
4 files changed, 93 insertions, 0 deletions
diff --git a/third_party/rust/darling_macro/.cargo-checksum.json b/third_party/rust/darling_macro/.cargo-checksum.json new file mode 100644 index 0000000000..2f56ee886e --- /dev/null +++ b/third_party/rust/darling_macro/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"772583c440b7413dfc8fe74b455978310f5a9b321733c973bdaeb1cd21cfb2ca","LICENSE":"8ea93490d74a5a1b1af3ff71d786271b3f1e5f0bea79ac16e02ec533cef040d6","src/lib.rs":"88141a58dc13b9001a83ca7559b6213ab44641510b6d642a3280c244ad735cec"},"package":"0cd3e432e52c0810b72898296a69d66b1d78d1517dff6cde7a130557a55a62c1"}
\ No newline at end of file diff --git a/third_party/rust/darling_macro/Cargo.toml b/third_party/rust/darling_macro/Cargo.toml new file mode 100644 index 0000000000..61f76a70c3 --- /dev/null +++ b/third_party/rust/darling_macro/Cargo.toml @@ -0,0 +1,30 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +name = "darling_macro" +version = "0.10.1" +authors = ["Ted Driggs <ted.driggs@outlook.com>"] +description = "Internal support for a proc-macro library for reading attributes into structs when\nimplementing custom derives. Use https://crates.io/crates/darling in your code.\n" +license = "MIT" +repository = "https://github.com/TedDriggs/darling" + +[lib] +proc-macro = true +[dependencies.darling_core] +version = "=0.10.1" + +[dependencies.quote] +version = "1" + +[dependencies.syn] +version = "1" diff --git a/third_party/rust/darling_macro/LICENSE b/third_party/rust/darling_macro/LICENSE new file mode 100644 index 0000000000..0b48eadc9d --- /dev/null +++ b/third_party/rust/darling_macro/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Ted Driggs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/third_party/rust/darling_macro/src/lib.rs b/third_party/rust/darling_macro/src/lib.rs new file mode 100644 index 0000000000..629526c553 --- /dev/null +++ b/third_party/rust/darling_macro/src/lib.rs @@ -0,0 +1,41 @@ +extern crate proc_macro; +#[macro_use] +extern crate syn; + +extern crate darling_core; + +use proc_macro::TokenStream; + +use darling_core::{derive, Error}; + +#[proc_macro_derive(FromMeta, attributes(darling))] +pub fn derive_from_meta(input: TokenStream) -> TokenStream { + derive::from_meta(&parse_macro_input!(input)).into() +} + +#[proc_macro_derive(FromMetaItem, attributes(darling))] +pub fn derive_from_meta_item(_input: TokenStream) -> TokenStream { + Error::custom("darling::FromMetaItem has been replaced by darling::FromMeta") + .write_errors() + .into() +} + +#[proc_macro_derive(FromDeriveInput, attributes(darling))] +pub fn derive_from_input(input: TokenStream) -> TokenStream { + derive::from_derive_input(&parse_macro_input!(input)).into() +} + +#[proc_macro_derive(FromField, attributes(darling))] +pub fn derive_field(input: TokenStream) -> TokenStream { + derive::from_field(&parse_macro_input!(input)).into() +} + +#[proc_macro_derive(FromTypeParam, attributes(darling))] +pub fn derive_type_param(input: TokenStream) -> TokenStream { + derive::from_type_param(&parse_macro_input!(input)).into() +} + +#[proc_macro_derive(FromVariant, attributes(darling))] +pub fn derive_variant(input: TokenStream) -> TokenStream { + derive::from_variant(&parse_macro_input!(input)).into() +} |