use enum_macros::UnwrapVariant; #[derive(UnwrapVariant)] #[allow(dead_code)] enum Test { #[unwrap(ref, mut, ref)] A(String), B(usize), } fn main() {}