加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.rs 709 Bytes
一键复制 编辑 原始数据 按行查看 历史
Kuo Hainan 提交于 2023-12-08 15:06 . :construction:WIP(common): 第七题:进行中
// Write code here.
//
// To see what the code looks like after macro expansion:
// $ cargo expand
//
// To run the code:
// $ cargo run
//* //
use derive_builder::Builder;
#[derive(Builder)]
pub struct Command {
executable: String,
#[builder(each = "arg")]
args: Vec<String>,
#[builder(each = "env")]
env: Vec<String>,
current_dir: Option<String>,
}
fn main() {
let command = Command::builder()
.executable("cargo".to_owned())
.arg("build".to_owned())
.arg("--release".to_owned())
.build()
.unwrap();
assert_eq!(command.executable, "cargo");
assert_eq!(command.args, vec!["build", "--release"]);
}
// */ fn main() {}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化