optional_struct 0.5.2

Crate defining a macro that will generate, from a structure, another structure with only Option<T> fields
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//#![feature(stmt_expr_attributes)]
use optional_struct::*;

#[optional_struct]
struct Foo {
    #[cfg(all())]
    bar: u8,
    #[cfg(any())]
    baz: u8,
}

#[test]
fn test_match_cfg_attributes() {
    let mut foo = Foo { bar: 1 };

    let opt_foo = OptionalFoo { bar: Some(1) };
    opt_foo.apply_to(&mut foo);
}