Currently this is not supported in stable.
However there is a feature in nightly called concat_idents
:
concat_idents!(my_test_, $id)
See
Update: it seems there aren’t near-term plans to add this into stable releases, see issue.
More Related Contents:
- Is it possible to declare variables procedurally using Rust macros?
- Can a Rust macro create new identifiers?
- Generating documentation in macros
- How do I match the type of an expression in a Rust macro?
- Is there a way to count with macros?
- Can macros match against constant arguments instead of literals?
- How to allow optional trailing commas in macros?
- How to embed a Rust macro variable into documentation?
- How to enforce that a type implements a trait at compile time?
- What makes Lisp macros so special?
- Macros in Swift?
- How can I generate unique values in the C preprocessor?
- Variadic recursive preprocessor macros – is it possible?
- How do I show the value of a #define at compile-time?
- How to write macro for Notepad++?
- How to auto execute a macro when opening a Powerpoint presentation?
- Mathematica: Unevaluated vs Defer vs Hold vs HoldForm vs HoldAllComplete vs etc etc
- Can I convert a string to enum without macros in Rust?
- Is there a way to get the field names of a struct in a macro?
- How do I create a heterogeneous collection of objects?
- How do I require a generic type implement an operation like Add, Sub, Mul, or Div in a generic function?
- What does “mismatched types: expected `()`” mean when using an if expression?
- How does a C-style struct with a bitfield get represented in a Rust #[repr(C)] struct?
- Why does an enum require extra memory size?
- How can I override a constant via a compiler option?
- PostgreSQL authentication method 10 not supported
- How to mock specific methods but not all of them in Rust?
- Is there any way to allocate a standard Rust array directly on the heap, skipping the stack entirely?
- Rust lifetime error expected concrete lifetime but found bound lifetime
- How can I build multiple binaries with Cargo?