diff --git a/rpc-toolkit/src/rpc_server_helpers.rs b/rpc-toolkit/src/rpc_server_helpers.rs index af9b778..ed4d626 100644 --- a/rpc-toolkit/src/rpc_server_helpers.rs +++ b/rpc-toolkit/src/rpc_server_helpers.rs @@ -100,25 +100,29 @@ pub fn to_response StatusCode>( } // &mut Request -> Result -> Future -> Future>, Response>, HttpError>>>, Response>, HttpError> -pub type DynMiddleware<'a, 'b, 'c, Params> = Box< - dyn FnOnce( +pub type DynMiddleware = Box< + dyn for<'a> FnOnce( &'a mut Request, ) -> BoxFuture< 'a, - Result, Response>, HttpError>, + Result, Response>, HttpError>, > + Send + Sync, >; -pub type DynMiddlewareStage2<'a, 'b, Params> = Box< - dyn FnOnce( +pub type DynMiddlewareStage2 = Box< + dyn for<'a> FnOnce( &'a mut RpcRequest>, - ) - -> BoxFuture<'a, Result, Response>, HttpError>> + ) -> BoxFuture< + 'a, + Result>, HttpError>, + > + Send + + Sync, +>; +pub type DynMiddlewareStage3 = Box< + dyn for<'a> FnOnce(&'a mut Response) -> BoxFuture<'a, Result<(), HttpError>> + Send + Sync, >; -pub type DynMiddlewareStage3<'a> = - Box) -> BoxFuture<'a, Result<(), HttpError>> + Send + Sync>; pub fn constrain_middleware< 'a, diff --git a/rpc-toolkit/tests/test.rs b/rpc-toolkit/tests/test.rs index ea3bfcd..c260621 100644 --- a/rpc-toolkit/tests/test.rs +++ b/rpc-toolkit/tests/test.rs @@ -89,9 +89,9 @@ fn dothething2 Deserialize<'a> + FromStr, E: Dis )) } -async fn cors<'a, 'b, Params: for<'de> Deserialize<'de> + 'static>( +async fn cors Deserialize<'de> + 'static>( req: &mut Request, -) -> Result, Response>, HttpError> { +) -> Result, Response>, HttpError> { if req.method() == hyper::Method::OPTIONS { Ok(Err(Response::builder() .header("Access-Control-Allow-Origin", "*")