1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
pub enum TypeCtor { Slice, Array, } pub struct ApplicationTy(TypeCtor); macro_rules! ty_app { ($ctor:pat) => { ApplicationTy($ctor) }; } pub fn foo(ty: ApplicationTy) { match ty { ty_app!(TypeCtor::Array) => {} } }