Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Attributes (see also Attributes in Rust by Example) are metadata attached to objects and processed by the compiler for different purposes. Some attributes are macros, called attribute-like macros.

Macros are a metaprogramming feature of a language. They can be found in languages like C/C++ or Julia. Macros are not part of the language itself, they are processed by the pre-processor which expands them into language code before the real parsing of the code. Macros allow us to define a block and repeat it wherever we need it.

In Rust, macros are devided into: