handle_async_api_request: put rpcenv into a Box

So that we can pass rpcenv into futures.
This commit is contained in:
Dietmar Maurer
2019-05-09 18:01:24 +02:00
parent 2c41096a4b
commit b4b63e520d
8 changed files with 37 additions and 16 deletions

View File

@ -75,7 +75,7 @@ macro_rules! http_err {
}
type ApiAsyncHandlerFn = Box<
dyn Fn(Parts, Body, Value, &ApiAsyncMethod, &mut dyn RpcEnvironment) -> Result<BoxFut, Error>
dyn Fn(Parts, Body, Value, &ApiAsyncMethod, Box<RpcEnvironment>) -> Result<BoxFut, Error>
+ Send + Sync + 'static
>;
@ -152,7 +152,7 @@ impl ApiAsyncMethod {
pub fn new<F>(handler: F, parameters: ObjectSchema) -> Self
where
F: Fn(Parts, Body, Value, &ApiAsyncMethod, &mut dyn RpcEnvironment) -> Result<BoxFut, Error>
F: Fn(Parts, Body, Value, &ApiAsyncMethod, Box<RpcEnvironment>) -> Result<BoxFut, Error>
+ Send + Sync + 'static,
{
Self {