From ed52d304178d5d37a0af710f06e8fe8eb65b2c24 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 3 Apr 2023 02:44:25 +0000 Subject: feat(router): GET RID OF DIRTY BOXES --- src/handler.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/handler.rs') 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) -> Response + Send + Sync>; +pub trait RouteResponse: + FnMut(RouteContext<'_>) -> Response + Send + Sync +{ +} + +impl RouteResponse for T where T: FnMut(RouteContext<'_>) -> Response + Send + Sync +{} + pub type ErrorResponse = Box) -> Response + Send + Sync>; pub type Callback = Box) + Send + Sync>; -- cgit v1.2.3