1use darling_core::{derive, Error};
2use proc_macro::TokenStream;
3use syn::parse_macro_input;
4
5#[proc_macro_derive(FromMeta, attributes(darling))]
6pub fn derive_from_meta(input: TokenStream) -> TokenStream {
7 derive::from_meta(&parse_macro_input!(input)).into()
8}
9
10#[proc_macro_derive(FromMetaItem, attributes(darling))]
11pub fn derive_from_meta_item(_input: TokenStream) -> TokenStream {
12 ErrorTokenStream::custom(msg:"darling::FromMetaItem has been replaced by darling::FromMeta")
13 .write_errors()
14 .into()
15}
16
17#[proc_macro_derive(FromAttributes, attributes(darling))]
18pub fn derive_from_attributes(input: TokenStream) -> TokenStream {
19 derive::from_attributes(&parse_macro_input!(input)).into()
20}
21
22#[proc_macro_derive(FromDeriveInput, attributes(darling))]
23pub fn derive_from_input(input: TokenStream) -> TokenStream {
24 derive::from_derive_input(&parse_macro_input!(input)).into()
25}
26
27#[proc_macro_derive(FromField, attributes(darling))]
28pub fn derive_field(input: TokenStream) -> TokenStream {
29 derive::from_field(&parse_macro_input!(input)).into()
30}
31
32#[proc_macro_derive(FromTypeParam, attributes(darling))]
33pub fn derive_type_param(input: TokenStream) -> TokenStream {
34 derive::from_type_param(&parse_macro_input!(input)).into()
35}
36
37#[proc_macro_derive(FromVariant, attributes(darling))]
38pub fn derive_variant(input: TokenStream) -> TokenStream {
39 derive::from_variant(&parse_macro_input!(input)).into()
40}
41