Skip to main content

ai_descriptor_derive/
lib.rs

1// ---------------- [ File: ai-descriptor-derive/src/lib.rs ]
2#![allow(dead_code)]
3#![allow(unused_imports)]
4extern crate proc_macro;
5#[macro_use] mod imports; use imports::*;
6
7xp!{find_ai_attr}
8xp!{find_feature_if_none}
9xp!{get_option_inner_type}
10xp!{has_ai_display}
11xp!{is_option_type}
12xp!{item_with_features}
13xp!{impl_item_feature}
14xp!{impl_item_feature_enum}
15xp!{impl_item_feature_struct}
16xp!{process_field}
17xp!{process_variant}
18
19#[proc_macro_derive(ItemFeature, attributes(ai))]
20pub fn item_feature_derive(input: TokenStream) -> TokenStream {
21    // Parse the input tokens into a syntax tree
22    let input = parse_macro_input!(input as DeriveInput);
23
24    // Generate the implementation
25    impl_item_feature(&input).into()
26}
27
28#[proc_macro_derive(ItemWithFeatures, attributes(ai))]
29pub fn item_with_features_derive(input: TokenStream) -> TokenStream {
30
31    // Parse the input tokens into a syntax tree
32    let input = parse_macro_input!(input as DeriveInput);
33
34    // Generate the implementation
35    impl_item_with_features(&input).into()
36}