mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-30 12:21:58 +00:00
fix cli-only
This commit is contained in:
@@ -260,6 +260,7 @@ fn rpc_handler(
|
|||||||
let param_generics = param_generics_filter.finish();
|
let param_generics = param_generics_filter.finish();
|
||||||
let (_, param_ty_generics, _) = param_generics.split_for_impl();
|
let (_, param_ty_generics, _) = param_generics.split_for_impl();
|
||||||
let param_struct_def = quote! {
|
let param_struct_def = quote! {
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(::rpc_toolkit::command_helpers::prelude::Deserialize)]
|
#[derive(::rpc_toolkit::command_helpers::prelude::Deserialize)]
|
||||||
pub struct Params#param_ty_generics {
|
pub struct Params#param_ty_generics {
|
||||||
#(
|
#(
|
||||||
@@ -666,9 +667,12 @@ fn cli_handler(
|
|||||||
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
mut rt: Option<::rpc_toolkit::command_helpers::prelude::Runtime>,
|
||||||
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
matches: &::rpc_toolkit::command_helpers::prelude::ArgMatches<'_>,
|
||||||
_method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
_method: ::rpc_toolkit::command_helpers::prelude::Cow<'_, str>,
|
||||||
_parent_params: ParentParams
|
parent_params: ParentParams
|
||||||
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
) -> Result<(), ::rpc_toolkit::command_helpers::prelude::RpcError> {
|
||||||
|
#param_struct_def
|
||||||
|
|
||||||
#rt_action
|
#rt_action
|
||||||
|
|
||||||
Ok(#display_res)
|
Ok(#display_res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -850,5 +854,6 @@ pub fn build(args: AttributeArgs, mut item: ItemFn) -> TokenStream {
|
|||||||
#cli_handler
|
#cli_handler
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// panic!("{}", res);
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ pub fn to_response<F: Fn(i32) -> StatusCode>(
|
|||||||
res.body(Body::from(body))
|
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<
|
pub type DynMiddleware<'a, 'b, 'c, Params> = Box<
|
||||||
dyn FnOnce(
|
dyn FnOnce(
|
||||||
&'a mut Request<Body>,
|
&'a mut Request<Body>,
|
||||||
|
|||||||
Reference in New Issue
Block a user