enum-ref 0.1.0

Proc. macro for generating enum discriminant types.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use enum_ref::{EnumRef, EnumMut};

#[derive(EnumRef, EnumMut)]
enum Test<'a, T, const N: usize> {
    Unit,
    Ref(&'a T),
    Mut(&'a mut T),
    Value(T),
    NamedValue { a: T },
    Bytes([u8; N]),
}

type TestRef<'lt, 'a, T, const N: usize> = <Test<'a, T, N> as EnumRef>::Ref<'a>;
type TestMut<'lt, 'a, T, const N: usize> = <Test<'a, T, N> as EnumMut>::Mut<'a>;

fn main() {}