educe/trait_handlers/default/
mod.rs1mod default_enum;
2mod default_struct;
3mod default_union;
4mod models;
5mod panic;
6
7use syn::{Data, DeriveInput, Meta};
8
9use super::TraitHandler;
10use crate::Trait;
11
12pub(crate) struct DefaultHandler;
13
14impl TraitHandler for DefaultHandler {
15 #[inline]
16 fn trait_meta_handler(
17 ast: &DeriveInput,
18 token_stream: &mut proc_macro2::TokenStream,
19 traits: &[Trait],
20 meta: &Meta,
21 ) -> syn::Result<()> {
22 match ast.data {
23 Data::Struct(_) => default_struct::DefaultStructHandler::trait_meta_handler(
24 ast,
25 token_stream,
26 traits,
27 meta,
28 ),
29 Data::Enum(_) => default_enum::DefaultEnumHandler::trait_meta_handler(
30 ast,
31 token_stream,
32 traits,
33 meta,
34 ),
35 Data::Union(_) => default_union::DefaultUnionHandler::trait_meta_handler(
36 ast,
37 token_stream,
38 traits,
39 meta,
40 ),
41 }
42 }
43}