【文件属性】:
文件名称:structopt:通过定义结构来解析命令行参数
文件大小:115KB
文件格式:ZIP
更新时间:2021-02-27 05:00:55
Rust
结构优化
通过定义结构来解析命令行参数。 它结合了和自定义派生。
文献资料
在上找到它。 您还可以检查和 。
例子
将structopt添加到您的Cargo.toml依赖Cargo.toml :
[ dependencies ]
structopt = " 0.3 "
然后,在您的rust文件中:
use std :: path :: PathBuf ;
use structopt :: StructOpt;
/// A basic example
#[derive(StructOpt, Debug)]
#[structopt(name = "basic" )]
struct Opt {
// A flag, true if used in the command line. Note doc comment will
// be used for the help