aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-09-18 12:36:49 +0200
committerHampusM <hampus@hampusmat.com>2022-09-18 12:36:49 +0200
commita93fc9fb080151f7ed66af7a923db544a41556cd (patch)
tree503370be6e15c3d0d0bbfbe17b681780c3c6eb02
parente210a95b9724bf9c471090d629c5962e3e411711 (diff)
test: move some factory function types to type aliases
-rw-r--r--src/di_container.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/di_container.rs b/src/di_container.rs
index 532a905..ac75f81 100644
--- a/src/di_container.rs
+++ b/src/di_container.rs
@@ -972,6 +972,13 @@ mod tests
}
}
+ type FactoryFunc = dyn Fn<
+ (std::rc::Rc<DIContainer>,),
+ Output = Box<
+ dyn Fn<(Vec<i128>,), Output = crate::ptr::TransientPtr<dyn IUserManager>>,
+ >,
+ >;
+
use crate as syrette;
#[crate::factory]
@@ -992,12 +999,7 @@ mod tests
let di_container = DIContainer::new();
- let factory_func: &'static dyn Fn<
- (std::rc::Rc<DIContainer>,),
- Output = Box<
- dyn Fn<(Vec<i128>,), Output = crate::ptr::TransientPtr<dyn IUserManager>>,
- >,
- > = &|_: Rc<DIContainer>| {
+ let factory_func: &'static FactoryFunc = &|_: Rc<DIContainer>| {
Box::new(move |users| {
let user_manager: TransientPtr<dyn IUserManager> =
TransientPtr::new(UserManager::new(users));
@@ -1066,6 +1068,13 @@ mod tests
}
}
+ type FactoryFunc = dyn Fn<
+ (std::rc::Rc<DIContainer>,),
+ Output = Box<
+ dyn Fn<(Vec<i128>,), Output = crate::ptr::TransientPtr<dyn IUserManager>>,
+ >,
+ >;
+
use crate as syrette;
#[crate::factory]
@@ -1086,12 +1095,7 @@ mod tests
let di_container = DIContainer::new();
- let factory_func: &'static dyn Fn<
- (std::rc::Rc<DIContainer>,),
- Output = Box<
- dyn Fn<(Vec<i128>,), Output = crate::ptr::TransientPtr<dyn IUserManager>>,
- >,
- > = &|_: Rc<DIContainer>| {
+ let factory_func: &'static FactoryFunc = &|_: Rc<DIContainer>| {
Box::new(move |users| {
let user_manager: TransientPtr<dyn IUserManager> =
TransientPtr::new(UserManager::new(users));