File:Procedural Macros in Rust (part 1).webm

Summary

Description
English: In this stream, we take a look at Rust's procedural macros. These are much more flexible than the declarative macros you get with the macro_rules! construct, and effectively allow you to write source-code transformations as a separate program. Take a look at https://doc.rust-lang.org/book/ch19-06-macros.html and https://doc.rust-lang.org/nightly/reference/procedural-macros.html for details.

In particular, we follow David Tolnay's excellent proc-macro workshop from Rust Latam back in March 2019: https://github.com/dtolnay/proc-macro-workshop. The goal is to implement the custom derive(Builder) project (the first one listed). We managed to get all the way through and then some!

For tools, we ended up relying quite heavily on David's https://github.com/dtolnay/syn and https://github.com/dtolnay/quote, as well as the very handy cargo-expand tool: https://github.com/dtolnay/cargo-expand.

You can find the code over at https://github.com/jonhoo/proc-macro-workshop.

Oh, and the issue with formatting doc comments we encountered at the end has already been fixed @ https://github.com/rust-lang/rustfmt/pull/3548 !

You can see the live version with comments at https://www.youtube.com/watch?v=0-sMn2fXYG4
Date
Source YouTube: Procedural Macros in Rust (part 1) – View/save archived versions on archive.org and archive.todayCategory:Media from YouTube
Author Jon Gjengset

Licensing

This video, screenshot or audio excerpt was originally uploaded on YouTube under a CC BY license.
Their website states: "YouTube allows users to mark their videos with a Creative Commons CC BY license."
To the uploader: You must provide a link (URL) to the original file and the authorship information if available.
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 3.0 Unported license.
Attribution:
Jon Gjengset
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Category:CC-BY-3.0#Procedural%20Macros%20in%20Rust%20(part%201).webm
Category:Media from YouTube#Procedural%20Macros%20in%20Rust%20(part%201).webm
This file, which was originally posted to an external website, has not yet been reviewed by an administrator or reviewer to confirm that the above license is valid. See Category:License review needed for further instructions.
Category:License review needed (video)#153340981 Category:Uploaded with video2commons Category:Videos of Rust (programming language)
Category:CC-BY-3.0 Category:License review needed (video) Category:Media from YouTube Category:Uploaded with video2commons Category:Videos of Rust (programming language)