Is it possible to get static
lifetimes from Clap's arg parser?
let args = App::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.bin_name(env!("CARGO_PKG_NAME"))
.arg(
Arg::with_name("db-name")
.short("d")
.long("db-name")
.value_name("NAME")
.help("Sets database name")
.takes_value(true),
)
.get_matches();
let db_name = args.value_of(val)?; // <-- want as &'static str
Currently getting them as &str
. The end goal is to have a single config object that lasts for the lifetime of the program. I don't really want to copy the values around either, just to remain in a single location.