Function quad_url::get_program_parameters [−][src]
pub fn get_program_parameters() -> Vec<String>
Expand description
Function to get «command line parameters» from query string in URL.
This function just returns env::args().collect()
for non-WASM. But for WASM with link https://.../index.html?k=1&begin&something=spa%20ce
it has same effect like running this program with command line parameters: myprog -k=1 --begin --something="spa ce"
.
This works just by replacing key and value in this manner:
k=1
→-k=1
begin
→--begin
something=spa%20ce
→--something="spa ce"
Also, this plugin supports unicode in query.
Notice that one-leters keys in URL treated as single-dash always. So, you can’t present myprog --k=1
in the address.
Usage with clap
use quad_url::get_program_parameters;
let app = App::new("myapp");
// ...
let matches = app.get_matches_from_safe_borrow(get_program_parameters().iter());