fix cli-only

This commit is contained in:
Aiden McClelland
2021-06-28 17:23:09 -06:00
parent b449c4265a
commit dc24f147c0
2 changed files with 7 additions and 1 deletions

View File

@@ -260,6 +260,7 @@ fn rpc_handler(
let param_generics = param_generics_filter.finish();
let (_, param_ty_generics, _) = param_generics.split_for_impl();
let param_struct_def = quote! {
#[allow(dead_code)]
#[derive(::rpc_toolkit::command_helpers::prelude::Deserialize)]
pub struct Params#param_ty_generics {
#(
@@ -666,9 +667,12 @@ fn cli_handler(
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
_method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
_parent_params: ParentParams
parent_params: ParentParams
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
#param_struct_def
#rt_action
Ok(#display_res)
}
}
@@ -850,5 +854,6 @@ pub fn build(args: AttributeArgs, mut item: ItemFn) -> TokenStream {
#cli_handler
}
};
// panic!("{}", res);
res
}

View File

@@ -99,6 +99,7 @@ pub fn to_response<F: Fn(i32) -> StatusCode>(
res.body(Body::from(body))
}
// &mut Request<Body> -> Result<Result<Future<&mut RpcRequest<...> -> Future<Result<Result<&mut Response<Body> -> Future<Result<(), HttpError>>, Response<Body>>, HttpError>>>, Response<Body>>, HttpError>
pub type DynMiddleware<'a, 'b, 'c, Params> = Box<
dyn FnOnce(
&'a mut Request<Body>,