darth_rust/
lib.rs

1mod build;
2mod builder;
3mod crates;
4mod default;
5mod from_acc;
6mod from_aes;
7mod from_bytes;
8mod from_camellia;
9mod from_chacha;
10mod from_hex;
11mod from_json;
12mod getters;
13mod helpers;
14mod math;
15mod mut_getters;
16mod printers;
17mod printers_by_field;
18mod printers_err_by_field;
19mod printers_info_by_field;
20mod printers_rust_by_field;
21mod printers_success_by_field;
22mod printers_warning_by_field;
23mod setters;
24mod to_acc;
25mod to_aes;
26mod to_arc;
27mod to_arc_mutex;
28mod to_box;
29mod to_bytes;
30mod to_camellia;
31mod to_chacha;
32mod to_hex;
33mod to_json;
34mod to_mutex;
35mod to_rc;
36mod to_rc_weak;
37mod to_ref_cell;
38mod validators;
39
40use crates::*;
41use helpers::{Helpers, HelpersTrait};
42
43#[proc_macro_derive(
44    DarthRust,
45    attributes(
46        pattern,
47        pattern_notify,
48        min_notify,
49        max_notify,
50        min,
51        max,
52        attr
53    )
54)]
55
56pub fn darth_rust(input: TokenStream) -> TokenStream {
57    let input = parse_macro_input!(input as DeriveInput);
58    let build = Build::new(input.clone());
59    let mut helpers = Helpers::new().input(input.clone());
60    helpers.add_traits_to_generics();
61    let (impl_generics, ty_generics, where_clause) =
62        helpers.generics_split_for_impl();
63    let struct_name = &input.ident;
64    let methods = build.gen();
65    let expanded = quote! {
66        impl #impl_generics #struct_name #ty_generics #where_clause {
67            #methods
68        }
69    };
70    expanded.into()
71}