option-constructor-derive

Crates.iooption-constructor-derive
lib.rsoption-constructor-derive
version0.1.1
sourcesrc
created_at2017-03-13 09:37:08.170869
updated_at2017-03-13 14:31:37.822412
descriptionConstructor helper
homepagehttps://github.com/iovxw/option-constructor-derive
repositoryhttps://github.com/iovxw/option-constructor-derive
max_upload_size
id8960
size9,230
iovxw (iovxw)

documentation

https://docs.rs/option-constructor-derive

README

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.

Commit count: 4

cargo fmt