About 50 results
Open links in new tab
  1. Macros - The Rust Programming Language

    To learn more about how to write macros, consult the online documentation or other resources, such as “The Little Book of Rust Macros” started by Daniel Keep and continued by Lukas Wirth.

  2. Macros - The Rust Reference

    The functionality and syntax of Rust can be extended with custom definitions called macros. They are given names, and invoked through a consistent syntax: some_extension!(...).

  3. Macros by example - The Rust Reference

    When a macro is invoked, the macro expander looks up macro invocations by name, and tries each macro rule in turn. It transcribes the first successful match; if this results in an error, then future …

  4. macro_rules! - Rust By Example

    macro_rules! Rust provides a powerful macro system that allows metaprogramming. As you've seen in previous chapters, macros look like functions, except that their name ends with a bang !, but instead …

  5. Syntax - Rust By Example

    Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries.

  6. Procedural macros - The Rust Reference

    Procedural macros allow you to run code at compile time that operates over Rust syntax, both consuming and producing Rust syntax. You can sort of think of procedural macros as functions from …

  7. Overload - Rust By Example

    Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries.

  8. matches in std - Rust

    Dec 8, 2025 · The optional if guard can be used to add additional checks that must be true for the matched value, otherwise this macro will return false. When testing that a value matches a pattern, …

  9. DRY (Don't Repeat Yourself) - Rust By Example

    Macros allow writing DRY code by factoring out the common parts of functions and/or test suites. Here is an example that implements and tests the +=, *= and -= operators on Vec<T>:

  10. Attributes - The Rust Reference

    Expressions in meta items must macro-expand to literal expressions, which must not include integer or float type suffixes. Expressions which are not literal expressions will be syntactically accepted (and …