引数処理
Standard Library
コマンドライン引数はstd::env::args
を介して取得できます。これはそれぞれの引数を文字列としてyieldするイテレータを返します。
$ ./args 1 2 3
My path is ./args.
I got 3 arguments: ["1", "2", "3"].
Crates
Alternatively, there are numerous crates that can provide extra functionality
when creating command-line applications. The Rust Cookbook exhibits best
practices on how to use one of the more popular command line argument crates,
clap
.