rust - How to enter command line argument with docops? -


how can enter command line arguments in rust using docopts? i'd able enter u8 in vector , parse docopts.

you can use std::env::args method obtain iterator. then, can use .collect on iterator vector of strings.

use std::env; fn main () {     let args: vec<string> = env::args().collect();     println!("{:?}", args); } 

example output:

simon@simon-desktop:~$ rustc t.rs  simon@simon-desktop:~$ ./t abc def ["./t", "abc", "def"] 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -