mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-26 02:11:56 +00:00
wip: Inherited?
This commit is contained in:
@@ -83,10 +83,14 @@ fn make_api() -> ParentHandler {
|
|||||||
struct HelloParams {
|
struct HelloParams {
|
||||||
whom: String,
|
whom: String,
|
||||||
}
|
}
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize, Parser)]
|
||||||
|
struct InheritParams {
|
||||||
|
donde: String,
|
||||||
|
}
|
||||||
ParentHandler::new()
|
ParentHandler::new()
|
||||||
.subcommand(
|
.subcommand(
|
||||||
"echo",
|
"echo",
|
||||||
ParentHandler::new()
|
ParentHandler::<NoParams, NoParams>::new()
|
||||||
.subcommand_no_cli(
|
.subcommand_no_cli(
|
||||||
"echo_no_cli",
|
"echo_no_cli",
|
||||||
from_fn(|c: CliContext| {
|
from_fn(|c: CliContext| {
|
||||||
@@ -111,6 +115,18 @@ fn make_api() -> ParentHandler {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.subcommand("a_hello", from_fn_async(a_hello))
|
.subcommand("a_hello", from_fn_async(a_hello))
|
||||||
|
// .subcommand_with_inherited(
|
||||||
|
// "inherited",
|
||||||
|
// ParentHandler::<NoParams, NoParams>::new().subcommand_no_cli(
|
||||||
|
// "echo_no_cli",
|
||||||
|
// from_fn(|c: CliContext| {
|
||||||
|
// Ok::<_, RpcError>(
|
||||||
|
// format!("Subcommand No Cli: Host {host}", host = c.host()).to_string(),
|
||||||
|
// )
|
||||||
|
// }),
|
||||||
|
// ),
|
||||||
|
// |InheritParams { donde }, _| InheritParams { donde },
|
||||||
|
// )
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn internal_error(e: impl Display) -> RpcError {
|
pub fn internal_error(e: impl Display) -> RpcError {
|
||||||
|
|||||||
Reference in New Issue
Block a user