superstruct 0.10.1

Versioned data types with minimal boilerplate
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use superstruct::*;

#[superstruct(
    variants(A, B),
    variant_attributes(cfg_attr(all(), derive(PartialEq, Debug)))
)]
#[cfg_attr(all(), derive(PartialEq, Debug))]
struct Thing {
    x: u64,
}

#[test]
fn thing_impls_partial_eq() {
    let t1 = Thing::A(ThingA { x: 5 });
    assert_eq!(t1, t1);
}