diff --git a/gotham_restful/src/openapi/router.rs b/gotham_restful/src/openapi/router.rs index e2113d5..ab4992b 100644 --- a/gotham_restful/src/openapi/router.rs +++ b/gotham_restful/src/openapi/router.rs @@ -419,7 +419,7 @@ macro_rules! implOpenapiRouter { fn create(&mut self) where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static { let schema = (self.0).1.add_schema::(); @@ -435,7 +435,7 @@ macro_rules! implOpenapiRouter { fn update_all(&mut self) where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static { let schema = (self.0).1.add_schema::(); @@ -451,7 +451,7 @@ macro_rules! implOpenapiRouter { fn update(&mut self) where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static { let schema = (self.0).1.add_schema::(); diff --git a/gotham_restful/src/result.rs b/gotham_restful/src/result.rs index 3108749..cb96636 100644 --- a/gotham_restful/src/result.rs +++ b/gotham_restful/src/result.rs @@ -80,7 +80,7 @@ impl Response /// A trait provided to convert a resource's result to json. -pub trait ResourceResult +pub trait ResourceResult : Send { type Err : Error + Send + 'static; @@ -151,6 +151,8 @@ fn errorlog(e : E) fn errorlog(_e : E) {} impl ResourceResult for Result +where + Self : Send { type Err = SerdeJsonError; @@ -267,6 +269,8 @@ impl Debug for Success } impl ResourceResult for Success +where + Self : Send { type Err = SerdeJsonError; @@ -460,6 +464,8 @@ impl ResourceResult for NoContent } impl ResourceResult for Result +where + Self : Send { type Err = SerdeJsonError; @@ -520,6 +526,8 @@ impl Debug for Raw } impl> ResourceResult for Raw +where + Self : Send { type Err = SerdeJsonError; // just for easier handling of `Result, E>` @@ -545,6 +553,7 @@ impl> ResourceResult for Raw impl ResourceResult for Result, E> where + Self : Send, Raw : ResourceResult { type Err = SerdeJsonError; diff --git a/gotham_restful/src/routing.rs b/gotham_restful/src/routing.rs index ee7cf31..22af7fb 100644 --- a/gotham_restful/src/routing.rs +++ b/gotham_restful/src/routing.rs @@ -73,17 +73,17 @@ pub trait DrawResourceRoutes fn create(&mut self) where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static; fn update_all(&mut self) where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static; fn update(&mut self) where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static; fn delete_all(&mut self); @@ -175,7 +175,7 @@ fn handle_with_body(state : State, get_result : F) -> Pin R + Send + 'static, - R : ResourceResult + Send + 'static + R : ResourceResult + 'static { body_to_res(state, get_result) .then(|(state, res)| match res { @@ -207,7 +207,7 @@ fn search_handler(mut state : State) -> Pin(state : State) -> Pin> where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static { handle_with_body::(state, |state, body| Handler::create(state, body)) @@ -215,7 +215,7 @@ where fn update_all_handler(state : State) -> Pin> where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static { handle_with_body::(state, |state, body| Handler::update_all(state, body)) @@ -223,7 +223,7 @@ where fn update_handler(state : State) -> Pin> where - Handler::Res : Send + 'static, + Handler::Res : 'static, Handler::Body : 'static { let id = {