substruct 0.1.3

A proc-macro to create subsets of structs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use substruct::substruct;

#[substruct(A, B, C)]
pub union A {
    #[substruct(A, B, C)]
    pub x: u64,
    #[substruct(A, B)]
    pub y: u32,
    #[substruct(A)]
    pub z: u16,
}

fn main() {
    let value = C { x: 77 };
    value.y = 1;
    value.z = 1;
}