2 releases

Uses old Rust 2015

0.1.1 Mar 13, 2017
0.1.0 Mar 13, 2017

#58 in #constructor

Unlicense

5KB
78 lines

option-constructor-derive

Travis Build Status Crates Documentation

Example

#[macro_use]
extern crate option_constructor_derive;

#[derive(OptionConstructor, Debug, PartialEq)]
struct Example {
    field1: bool,
    field2: Option<bool>,
    field3: Option<bool>,
}

fn main() {
    let x = Example::new(true).field2(false);
    assert_eq!(x, Example {
        field1: true,
        field2: Some(false),
        field3: None,
    });
}

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Dependencies

~2MB
~42K SLoC