A Practical Introduction to Declarative Macros in Rust

preview_player
Показать описание
In this video, we'll give you a practical introduction to declarative macros in Rust. We'll start with a simple example to help you understand what declarative macros are and how they can be written. We'll then explore positional, infinite positional, and named parameters in declarative macros, as well as fragment specifiers of parameters. By the end of this video, you'll have a solid understanding of declarative macros in Rust and how you can use them to make your code more concise and maintainable.

The background music for this video includes "Jazzy Hip Hop Boom Bap" and "Sweet Chillhop" by Music Unlimited, "Lofi Vintage" and "Street Food" by FASSounds.

Don't forget to follow me on my social media accounts:

Hashtags: #macros #declarative #rust #rustlang #metaprogramming

00:00 Introduction
00:06 What is a macro?
00:56 Warnings
01:38 Example project
01:58 Creating the project
02:07 A simple macro with positional parameters
02:42 Parameter types for declarative macros
03:26 Desugaring the macros with rust-analyzer
03:49 Another simple macro
04:07 Named parameters in declarative macros
05:06 Infinite positional parameters in declarative macros
06:33 Using macros outside a crate
06:47 Exporting macros to be used outside the crate
06:45 Using macros outside a crate (again)
07:15 Ending
Рекомендации по теме
Комментарии
Автор

I hope this can reach more people. Really good explanation of rust macros, thank you.
Looking forward to the next video!

danielm
Автор

This is cool, I want more tutorials, your explanation is very clear

kmaximoff
Автор

Thank you for your videos; I have learnt a lot about macros from your videos.

MirrorsEdgeGamer
Автор

Don't put code examples at the bottom of the screen and skim through them with lighting speed because there is no way to see them as youtube's player bar will visually block the code if you try to pause.

meanmole