educe/trait_handlers/deref_mut/
mod.rs1mod deref_mut_enum;
2mod deref_mut_struct;
3mod models;
4mod panic;
5
6use syn::{Data, DeriveInput, Meta};
7
8use super::TraitHandler;
9use crate::Trait;
10
11pub(crate) struct DerefMutHandler;
12
13impl TraitHandler for DerefMutHandler {
14 #[inline]
15 fn trait_meta_handler(
16 ast: &DeriveInput,
17 token_stream: &mut proc_macro2::TokenStream,
18 traits: &[Trait],
19 meta: &Meta,
20 ) -> syn::Result<()> {
21 match ast.data {
22 Data::Struct(_) => deref_mut_struct::DerefMutStructHandler::trait_meta_handler(
23 ast,
24 token_stream,
25 traits,
26 meta,
27 ),
28 Data::Enum(_) => deref_mut_enum::DerefMutEnumHandler::trait_meta_handler(
29 ast,
30 token_stream,
31 traits,
32 meta,
33 ),
34 Data::Union(_) => {
35 Err(crate::panic::trait_not_support_union(meta.path().get_ident().unwrap()))
36 },
37 }
38 }
39}