// Generate methods on the builder for setting a value of each of the struct // fields. // // impl CommandBuilder { // fn executable(&mut self, executable: String) -> &mut Self { // self.executable = Some(executable); // self // } // // ... // } use builders::Builder; #[derive(Builder)] pub struct Command { executable: String, args: Vec, env: Vec, current_dir: String, } fn main() { let mut builder = Command::builder(); builder.executable("cargo".to_owned()); builder.args(vec!["build".to_owned(), "--release".to_owned()]); builder.env(vec![]); builder.current_dir("..".to_owned()); }