let pattern = std::env::args().nth(1).expect("no City given. run weather cityname");
give me this output if no cityname is given to the binary at start...
./weather
thread 'main' panicked at src/main.rs:22:43:
no City given. run weather cityname
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted
How make it right that I only the the Message: no City given. run weather cityname
I’m not sure what you mean by “convert args to string”. args is essentially a list of strings. If you want to combine it all into a single string… well… you should probably share your use-case for why you want to do that, but I suppose you could concatenate it all separated by spaces if you really want to? With std, you could collect into a Vec<String>, then use .join(" "). Or get itertools to do it in one step.
How are you learning Rust? Have you tried reading the Rust book? It has translations in several languages if English is not your native language.
Please continue to ask questions if that is the best way for you to learn. I suggest using the Rust book to make sure you also have examples and written material to guide you.
Args::parse() is interesting; where is that function from? I thought we were discussing std::env::Args, still, but that one doesn’t have any such API?