diff options
author | HampusM <hampus@hampusmat.com> | 2022-09-18 12:36:49 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-09-18 12:36:49 +0200 |
commit | a93fc9fb080151f7ed66af7a923db544a41556cd (patch) | |
tree | 503370be6e15c3d0d0bbfbe17b681780c3c6eb02 /src | |
parent | e210a95b9724bf9c471090d629c5962e3e411711 (diff) |
test: move some factory function types to type aliases
Diffstat (limited to 'src')
-rw-r--r-- | src/di_container.rs | 28 |
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)); |