educe/trait_handlers/hash/
mod.rs

1mod hash_enum;
2mod hash_struct;
3mod hash_union;
4mod models;
5mod panic;
6
7use syn::{Data, DeriveInput, Meta};
8
9use super::TraitHandler;
10use crate::Trait;
11
12pub(crate) struct HashHandler;
13
14impl TraitHandler for HashHandler {
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(_) => {
24                hash_struct::HashStructHandler::trait_meta_handler(ast, token_stream, traits, meta)
25            },
26            Data::Enum(_) => {
27                hash_enum::HashEnumHandler::trait_meta_handler(ast, token_stream, traits, meta)
28            },
29            Data::Union(_) => {
30                hash_union::HashUnionHandler::trait_meta_handler(ast, token_stream, traits, meta)
31            },
32        }
33    }
34}