Forwarding a match pattern to a custom macro

Pattern matches are a compile time structure in code. You cannot „pass“ a pattern at runtime, so the only way to do it is using macros. When using macros you‘ll need to read up on macro hygine, so variables within generated code become accessible to code not being generated.