Refactor tags services and added tests

Implemented some functionality which will allow the service
configuration of the app to be split among the features for readability
and testability.
This commit is contained in:
Cameron Cordes
2023-03-19 15:05:20 -04:00
parent fbcfc68e01
commit de4041bd17
6 changed files with 143 additions and 50 deletions

16
src/service.rs Normal file
View File

@@ -0,0 +1,16 @@
use actix_web::App;
pub trait ServiceBuilder<T> {
fn add_feature<F>(self, f: F) -> App<T>
where
F: Fn(App<T>) -> App<T>;
}
impl<T> ServiceBuilder<T> for App<T> {
fn add_feature<F>(self, create_feature: F) -> App<T>
where
F: Fn(App<T>) -> App<T>,
{
create_feature(self)
}
}