diff options
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>; |