diff options
author | HampusM <hampus@hampusmat.com> | 2022-09-24 13:13:20 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-09-24 13:13:20 +0200 |
commit | 695f90bf900015df1e2728445f833dabced838a9 (patch) | |
tree | c68f2b483e3d20f400d27d4df159b2aec94d072f /macros/src/factory_type_alias.rs | |
parent | 3ed020425bfd1fc5fedfa89a7ce20207bedcf5bc (diff) |
refactor: reorganize modules in the macros crate
Diffstat (limited to 'macros/src/factory_type_alias.rs')
-rw-r--r-- | macros/src/factory_type_alias.rs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/macros/src/factory_type_alias.rs b/macros/src/factory_type_alias.rs deleted file mode 100644 index 64afe57..0000000 --- a/macros/src/factory_type_alias.rs +++ /dev/null @@ -1,35 +0,0 @@ -use quote::ToTokens; -use syn::parse::{Parse, ParseStream}; -use syn::punctuated::Punctuated; -use syn::{parse, ItemType, Token, Type}; - -use crate::fn_trait::FnTrait; - -pub struct FactoryTypeAlias -{ - pub type_alias: ItemType, - pub factory_interface: FnTrait, - pub arg_types: Punctuated<Type, Token![,]>, - pub return_type: Type, -} - -impl Parse for FactoryTypeAlias -{ - fn parse(input: ParseStream) -> syn::Result<Self> - { - let type_alias = match input.parse::<ItemType>() { - Ok(type_alias) => Ok(type_alias), - Err(_) => Err(input.error("Expected a type alias")), - }?; - - let aliased_fn_trait = - parse::<FnTrait>(type_alias.ty.as_ref().to_token_stream().into())?; - - Ok(Self { - type_alias, - factory_interface: aliased_fn_trait.clone(), - arg_types: aliased_fn_trait.inputs, - return_type: aliased_fn_trait.output, - }) - } -} |