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:
16
src/service.rs
Normal file
16
src/service.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user