builders 0.5.0

Rust macros for building structs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use builders::Builder;

#[derive(Builder)]
#[builder(infallible)]
pub struct Command {
    #[builder(def = { String::new() })]
    executable: String,
    #[builder(vec = "lol")]
    env: Vec<String>,
    #[builder(optional = true)]
    current_dir: Option<String>,
}

fn main() {
    let command = Command::builder().build();
    assert!(command.current_dir.is_none());
}