Rust (programming language): Difference between revisions

Content deleted Content added
Tcpp (talk | contribs)
Language extensions: snake_case is normative for attribute macro names
Tcpp (talk | contribs)
Language extensions: Procedural macros can be user-defined, too, so calling declarative macros user-defined is a false contrast
Line 163:
It is possible to extend the Rust language using the procedural macro mechanism.<ref name="rust-procedural-macros">{{cite web |url=https://doc.rust-lang.org/reference/procedural-macros.html |title=Procedural Macros |website=The Rust Programming Language Reference |access-date=23 Mar 2021 |archive-date=7 November 2020 |archive-url=https://web.archive.org/web/20201107233444/https://doc.rust-lang.org/reference/procedural-macros.html |url-status=live }}</ref>
 
Procedural macros use Rust functions that run at compile time to modify the compiler's token stream. This complements the user-defineddeclarative macro mechanism (also known as ''macros by example''), which uses pattern matching to achieve similar goals.
 
Procedural macros come in three flavors: