aboutsummaryrefslogtreecommitdiff
path: root/macros/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-09-24 13:13:20 +0200
committerHampusM <hampus@hampusmat.com>2022-09-24 13:13:20 +0200
commit695f90bf900015df1e2728445f833dabced838a9 (patch)
treec68f2b483e3d20f400d27d4df159b2aec94d072f /macros/src
parent3ed020425bfd1fc5fedfa89a7ce20207bedcf5bc (diff)
refactor: reorganize modules in the macros crate
Diffstat (limited to 'macros/src')
-rw-r--r--macros/src/factory/declare_default_args.rs (renamed from macros/src/decl_def_factory_args.rs)0
-rw-r--r--macros/src/factory/macro_args.rs (renamed from macros/src/factory_macro_args.rs)0
-rw-r--r--macros/src/factory/mod.rs3
-rw-r--r--macros/src/factory/type_alias.rs (renamed from macros/src/factory_type_alias.rs)0
-rw-r--r--macros/src/injectable/dependency.rs (renamed from macros/src/dependency.rs)2
-rw-r--r--macros/src/injectable/implementation.rs (renamed from macros/src/injectable_impl.rs)2
-rw-r--r--macros/src/injectable/macro_args.rs (renamed from macros/src/injectable_macro_args.rs)0
-rw-r--r--macros/src/injectable/mod.rs4
-rw-r--r--macros/src/injectable/named_attr_input.rs (renamed from macros/src/named_attr_input.rs)0
-rw-r--r--macros/src/lib.rs24
10 files changed, 19 insertions, 16 deletions
diff --git a/macros/src/decl_def_factory_args.rs b/macros/src/factory/declare_default_args.rs
index 6450583..6450583 100644
--- a/macros/src/decl_def_factory_args.rs
+++ b/macros/src/factory/declare_default_args.rs
diff --git a/macros/src/factory_macro_args.rs b/macros/src/factory/macro_args.rs
index dd80c1c..dd80c1c 100644
--- a/macros/src/factory_macro_args.rs
+++ b/macros/src/factory/macro_args.rs
diff --git a/macros/src/factory/mod.rs b/macros/src/factory/mod.rs
new file mode 100644
index 0000000..a8947c5
--- /dev/null
+++ b/macros/src/factory/mod.rs
@@ -0,0 +1,3 @@
+pub mod declare_default_args;
+pub mod macro_args;
+pub mod type_alias;
diff --git a/macros/src/factory_type_alias.rs b/macros/src/factory/type_alias.rs
index 64afe57..64afe57 100644
--- a/macros/src/factory_type_alias.rs
+++ b/macros/src/factory/type_alias.rs
diff --git a/macros/src/dependency.rs b/macros/src/injectable/dependency.rs
index d20af90..2c5e0fd 100644
--- a/macros/src/dependency.rs
+++ b/macros/src/injectable/dependency.rs
@@ -3,7 +3,7 @@ use std::error::Error;
use proc_macro2::Ident;
use syn::{parse2, FnArg, GenericArgument, LitStr, PathArguments, Type};
-use crate::named_attr_input::NamedAttrInput;
+use crate::injectable::named_attr_input::NamedAttrInput;
use crate::util::syn_path::syn_path_to_string;
pub struct Dependency
diff --git a/macros/src/injectable_impl.rs b/macros/src/injectable/implementation.rs
index bf5c96c..a84e798 100644
--- a/macros/src/injectable_impl.rs
+++ b/macros/src/injectable/implementation.rs
@@ -4,7 +4,7 @@ use quote::{format_ident, quote, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::{parse_str, ExprMethodCall, FnArg, Generics, ItemImpl, Type};
-use crate::dependency::Dependency;
+use crate::injectable::dependency::Dependency;
use crate::util::item_impl::find_impl_method_by_name_mut;
use crate::util::string::camelcase_to_snakecase;
use crate::util::syn_path::syn_path_to_string;
diff --git a/macros/src/injectable_macro_args.rs b/macros/src/injectable/macro_args.rs
index 50d4087..50d4087 100644
--- a/macros/src/injectable_macro_args.rs
+++ b/macros/src/injectable/macro_args.rs
diff --git a/macros/src/injectable/mod.rs b/macros/src/injectable/mod.rs
new file mode 100644
index 0000000..b713aeb
--- /dev/null
+++ b/macros/src/injectable/mod.rs
@@ -0,0 +1,4 @@
+pub mod dependency;
+pub mod implementation;
+pub mod macro_args;
+pub mod named_attr_input;
diff --git a/macros/src/named_attr_input.rs b/macros/src/injectable/named_attr_input.rs
index 5f7123c..5f7123c 100644
--- a/macros/src/named_attr_input.rs
+++ b/macros/src/injectable/named_attr_input.rs
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index b0ccc86..390d239 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -8,23 +8,18 @@ use proc_macro::TokenStream;
use quote::quote;
use syn::{parse, parse_macro_input, parse_str};
-mod decl_def_factory_args;
mod declare_interface_args;
-mod dependency;
-mod factory_macro_args;
-mod factory_type_alias;
+mod factory;
mod fn_trait;
-mod injectable_impl;
-mod injectable_macro_args;
+mod injectable;
mod libs;
mod macro_flag;
-mod named_attr_input;
mod util;
-use declare_interface_args::DeclareInterfaceArgs;
-use injectable_impl::InjectableImpl;
-use injectable_macro_args::InjectableMacroArgs;
-use libs::intertrait_macros::gen_caster::generate_caster;
+use crate::declare_interface_args::DeclareInterfaceArgs;
+use crate::injectable::implementation::InjectableImpl;
+use crate::injectable::macro_args::InjectableMacroArgs;
+use crate::libs::intertrait_macros::gen_caster::generate_caster;
/// Makes a struct injectable. Thereby usable with [`DIContainer`].
///
@@ -195,7 +190,8 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke
use quote::ToTokens;
use syn::Type;
- use crate::factory_macro_args::FactoryMacroArgs;
+ use crate::factory::macro_args::FactoryMacroArgs;
+ use crate::factory::type_alias::FactoryTypeAlias;
let FactoryMacroArgs { flags } = parse(args_stream).unwrap();
@@ -213,7 +209,7 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke
is_threadsafe = true;
}
- let factory_type_alias::FactoryTypeAlias {
+ let FactoryTypeAlias {
mut type_alias,
mut factory_interface,
arg_types: _,
@@ -327,7 +323,7 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke
#[cfg(feature = "factory")]
pub fn declare_default_factory(args_stream: TokenStream) -> TokenStream
{
- use crate::decl_def_factory_args::DeclareDefaultFactoryMacroArgs;
+ use crate::factory::declare_default_args::DeclareDefaultFactoryMacroArgs;
let DeclareDefaultFactoryMacroArgs { interface, flags } = parse(args_stream).unwrap();