Crates.io | option-constructor-derive |
lib.rs | option-constructor-derive |
version | 0.1.1 |
source | src |
created_at | 2017-03-13 09:37:08.170869 |
updated_at | 2017-03-13 14:31:37.822412 |
description | Constructor helper |
homepage | https://github.com/iovxw/option-constructor-derive |
repository | https://github.com/iovxw/option-constructor-derive |
max_upload_size | |
id | 8960 |
size | 9,230 |
#[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,
});
}
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.