diff options
author | HampusM <hampus@hampusmat.com> | 2022-07-18 20:48:41 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-07-18 20:49:33 +0200 |
commit | 8976c166cff4c98c43cdc409275f548eb27ecb13 (patch) | |
tree | f072980e77e12a85aac7282b89d3114cf69864a7 /syrette_macros/src/lib.rs | |
parent | 51e8d04c2299e6468213d8ee4f9e15d783094379 (diff) |
refactor: reduce the capabilities of the castable_to macro
Diffstat (limited to 'syrette_macros/src/lib.rs')
-rw-r--r-- | syrette_macros/src/lib.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/syrette_macros/src/lib.rs b/syrette_macros/src/lib.rs index 3145b5f..0a6f0e7 100644 --- a/syrette_macros/src/lib.rs +++ b/syrette_macros/src/lib.rs @@ -10,10 +10,7 @@ mod libs; use factory_type_alias::FactoryTypeAlias; use injectable_impl::InjectableImpl; use injectable_macro_args::InjectableMacroArgs; -use libs::intertrait_macros::{ - args::{Casts, Flag, Targets}, - gen_caster::generate_caster, -}; +use libs::intertrait_macros::{args::Cast, gen_caster::generate_caster}; /// Makes a struct injectable. Thereby usable with `DIContainer`. /// @@ -149,14 +146,7 @@ pub fn factory(_: TokenStream, type_alias_stream: TokenStream) -> TokenStream #[proc_macro] pub fn castable_to(input: TokenStream) -> TokenStream { - let Casts { - ty, - targets: Targets { flags, paths }, - } = parse_macro_input!(input); + let Cast { ty, target } = parse_macro_input!(input); - paths - .iter() - .map(|t| generate_caster(&ty, t, flags.contains(&Flag::Sync))) - .collect::<proc_macro2::TokenStream>() - .into() + generate_caster(&ty, &target).into() } |