mirror of
https://github.com/greatest-ape/aquatic.git
synced 2026-10-22 17:31:15 +00:00
cli helpers: in run function, take function as argument instead
This commit is contained in:
1 parent
ac52668a3d
commit
8dfd49af0d
2 files changed
+5
-5
No files matched your search
@@ -7,7 +7,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||
|
||||
|
||||
fn main(){
|
||||
cli_helpers::run_with_cli_and_config(
|
||||
cli_helpers::run_with_cli_and_config::<aquatic::config::Config>(
|
||||
"aquatic: udp bittorrent tracker",
|
||||
aquatic::run,
|
||||
)
|
||||
|
||||
@@ -36,11 +36,11 @@ fn default_config_as_toml<T>() -> String
|
||||
}
|
||||
|
||||
|
||||
pub fn run_with_cli_and_config<T, F>(
|
||||
pub fn run_with_cli_and_config<T>(
|
||||
title: &str,
|
||||
// Function that takes config file and runs application
|
||||
f: F,
|
||||
) where T: Default + Serialize + DeserializeOwned, F: Fn(T) {
|
||||
f: fn(T),
|
||||
) where T: Default + Serialize + DeserializeOwned {
|
||||
let args: Vec<String> = ::std::env::args().collect();
|
||||
|
||||
match AppOptions::parse_args_default(&args[1..]){
|
||||
@@ -77,4 +77,4 @@ fn print_help(title: &str, opt_error: Option<&str>){
|
||||
}
|
||||
|
||||
println!("\n{}", AppOptions::usage());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user