diff options
| author | Fuwn <[email protected]> | 2023-04-03 02:44:25 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-03 02:44:25 +0000 |
| commit | ed52d304178d5d37a0af710f06e8fe8eb65b2c24 (patch) | |
| tree | a1ce35c6a54d576361a6378c3cf59ea60ebc15e1 /src/handler.rs | |
| parent | feat(response): allow multiple languages (diff) | |
| download | windmark-ed52d304178d5d37a0af710f06e8fe8eb65b2c24.tar.xz windmark-ed52d304178d5d37a0af710f06e8fe8eb65b2c24.zip | |
feat(router): GET RID OF DIRTY BOXES
Diffstat (limited to 'src/handler.rs')
| -rw-r--r-- | src/handler.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/handler.rs b/src/handler.rs index 3429f3b..f22e3b3 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -22,8 +22,14 @@ use crate::{ returnable::{CallbackContext, RouteContext}, }; -pub type RouteResponse = - Box<dyn FnMut(RouteContext<'_>) -> Response + Send + Sync>; +pub trait RouteResponse: + FnMut(RouteContext<'_>) -> Response + Send + Sync +{ +} + +impl<T> RouteResponse for T where T: FnMut(RouteContext<'_>) -> Response + Send + Sync +{} + pub type ErrorResponse = Box<dyn FnMut(returnable::ErrorContext<'_>) -> Response + Send + Sync>; pub type Callback = Box<dyn FnMut(CallbackContext<'_>) + Send + Sync>; |