1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
fn main() { let rpc_server_config = RpcServerConfig::parse(); let addr = rpc_server_config.addr.unwrap_or("127.0.0.1".to_owned()); let port = rpc_server_config.port.unwrap_or(9999); }
#[derive(Debug, Parser)] #[clap(name = "rpcServer", version, author, about = "a rpc server")] struct RpcServerConfig { #[clap(short, long)] addr: Option<String>, #[clap(short, long)] port: Option<u32>, }
|