Тёмный

Ace Rust Macros ♠️ the declarative kind 

Code to the Moon
Подписаться 69 тыс.
Просмотров 38 тыс.
50% 1

A fast and concise but gentle introduction to writing declarative macros in Rust. The code from this video can be found here github.com/Me163/youtube/tree...
-
Stuff I use to make these videos - I absolutely love all of these products. Using these links is an easy way to support the channel, thank you so much if you do so!!!
Camera: Canon EOS R5 amzn.to/3CCrxzl
Monitor: Dell U4914DW 49in amzn.to/3MJV1jx
Lens: Sigma 24mm f/1.4 DG HSM Art for Canon EF amzn.to/3hZ10mz
SSD for Video Editing: VectoTech Rapid 8TB amzn.to/3hXz9TM
Microphone: Rode NT1-A amzn.to/3vWM4gL
Microphone Interface: Focusrite Clarett+ 2Pre amzn.to/3J5dy7S
Tripod: JOBY GorillaPod 5K amzn.to/3JaPxMA
Keyboard: Redragon Mechanical Gaming Keyboard amzn.to/3I1A7ZD
Mouse: Razer DeathAdder amzn.to/3J9fYCf
Computer: 2021 Macbook Pro amzn.to/3J7FXtW
Caffeine: High Brew Cold Brew Coffee amzn.to/3hXyx0q
More Caffeine: Monster Energy Juice, Pipeline Punch amzn.to/3Czmfox
Building A Second Brain book: amzn.to/3cIShWf

Наука

Опубликовано:

 

8 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 111   
@ultrapoci
@ultrapoci Год назад
Assigning "Bob" to variable "a" and "Alice" to variable "b" is just evil
@ohturry5591
@ohturry5591 Год назад
Lol😂
@ohturry5591
@ohturry5591 Год назад
It’s an sql relationship 🤫
@codetothemoon
@codetothemoon Год назад
hah, in retrospect that was a poor choice 🙃
@ThanhNguyen-lk6ns
@ThanhNguyen-lk6ns Год назад
It's a quantum teleportation 🤣
@furo.v
@furo.v Год назад
I was going to comment the same thing lol
@robinmoussu
@robinmoussu Год назад
I definitively love your style. Clear, short, on-topic!
@codetothemoon
@codetothemoon Год назад
Thanks Robin!!
@perc-ai
@perc-ai Год назад
This is the best rust macro video on RU-vid! Looking forward to all your future videos your quickly brecoming an industry leader
@codetothemoon
@codetothemoon Год назад
wow thanks for the kind words! I really enjoy making them!
@BrandonCharlesHouser
@BrandonCharlesHouser Год назад
In VS Code, if you hold alt and then press the up or down arrow it will move the line you are on or your entire selection up or down. It's great for reorganizing switch statements, if else ladders, and just re-organizing code.
@codetothemoon
@codetothemoon Год назад
ahh didn't know about this, thank you!
@egorsozonov7425
@egorsozonov7425 3 месяца назад
It’s not great, it’s terrible. Pressing Alt and arrows at the same time requires you to move your hand very far from the home row! Better editors like Neovim have saner hotkeys as well as a way to reassign them arbitrarily
@Ma1ne2
@Ma1ne2 Год назад
Loving these Rust videos so much, great to follow along and learn something new :) Keep them coming!
@codetothemoon
@codetothemoon Год назад
Thanks Noxdor, glad you are finding them valuable! more to come!
@AceofSpades5757
@AceofSpades5757 Год назад
That was a really good, light introduction into Rust's declarative macros. Thanks!
@codetothemoon
@codetothemoon Год назад
Thanks AceofSpades! It's almost as if the title and thumbnail were speaking directly to you 🙃
@eduardopereira2431
@eduardopereira2431 Год назад
Your Rust content its been incredible useful! Thank you!
@codetothemoon
@codetothemoon Год назад
Thanks Eduardo, thanks for watching!
@luccao173
@luccao173 6 месяцев назад
I have to say, you really got the best Rust content. exactly the right tempo and right hints
@codetothemoon
@codetothemoon 6 месяцев назад
thanks so much!
@ErikSchierboom
@ErikSchierboom Год назад
Lovely video! Love your pacing
@tonhom260
@tonhom260 10 месяцев назад
Love the way you teach us ,thank❤❤
@tryoasnafi4340
@tryoasnafi4340 Год назад
love your explanation style, simple, clear and well structured
@codetothemoon
@codetothemoon Год назад
Thanks Tryo!
@Akshay-be3qx
@Akshay-be3qx Год назад
Really cool way to explain. Thanks for taking time to make awesome videos.
@codetothemoon
@codetothemoon Год назад
Thanks for watching Akshay!
@learntry9074
@learntry9074 Год назад
Each video by you is to the point, and really it has helped me a lot. E.g, the video on 'result', I knew Result enum, but after watching it I learned the use case for map_err. Thank you
@perc-ai
@perc-ai Год назад
Hey there’s a new wave of rust developers especially after all the news that rust is changing everything… would love to see more videos from you
@codetothemoon
@codetothemoon Год назад
Thanks Zah, more are on the way!
@pup4301
@pup4301 Год назад
Hey remember you can use the rust language reference to help under stand the token syntax of a macro!
@codetothemoon
@codetothemoon Год назад
Agree, it's a great resource!
@jeffg4686
@jeffg4686 Год назад
Found an interesting syntax today, which is tuple pattern matching, where all elements of the tuple value can become 'wildcard' matches / variables'.
@codetothemoon
@codetothemoon Год назад
I find this feature super handy, I think it's called "destructuring"!
@jeffg4686
@jeffg4686 Год назад
@@codetothemoon - yeah, it's destructuring, but never seen it before in this context (matching).
@sparky173j
@sparky173j Год назад
Thankyou for this and all your other videos. I usually prefer learning these things from video demos over documentation. I've been procrastinating adding macros to my project. I'll probably mostly be using derive macros, but I think declarative macros will be a good place to start.
@codetothemoon
@codetothemoon Год назад
Thanks for watching tev. I really enjoy making them, especially when I get comments like this! Declarative macros can be a great place to start (though you don't have to). Will probably be making a custom derive video at some point...
@HyperFocusMarshmallow
@HyperFocusMarshmallow Год назад
Great introduction!!! It would be cool if you did one or a few follow ups of more advanced macros.
@tuanlam999
@tuanlam999 Год назад
Great concise content. Rust to the moon 🙂
@codetothemoon
@codetothemoon Год назад
Thanks Tuan! 🌙
@diwakargupta0
@diwakargupta0 Год назад
Awesome 🙌🙌
@codetothemoon
@codetothemoon Год назад
glad you found it valuable!
@zencephalon
@zencephalon Год назад
Great stuff!
@codetothemoon
@codetothemoon Год назад
Thanks Matthew!
@ozkavoshdjalla
@ozkavoshdjalla Год назад
It was cool! Thanks
@codetothemoon
@codetothemoon Год назад
Thanks for watching Ozkavosh!
@aksakalaradhita
@aksakalaradhita 10 месяцев назад
Man, you should have "in-depth rust" series
@codetothemoon
@codetothemoon 9 месяцев назад
would love to make such a thing!
@africknchickn_YT
@africknchickn_YT Год назад
if you do a similar walkthrough for proc macros, I *will* subscribe. In my experience, building a custom derive is a more common use case that I wish I had the time to learn in detail how to do, as opposed to defining and parsing a new DSL. So (if you're taking votes...) my vote would be for doing a recursive derive of structs and enums! If not, then no worries :) I'll still be around. Cheers dude!
@codetothemoon
@codetothemoon Год назад
Nice, I've been thinking a lot about a proc macro video. I've found it incredibly challenging to explain those concepts in a concise and digestable way - I think it can be done though! Thanks for watching!
@edgeeffect
@edgeeffect Год назад
​@@codetothemoon yeah! I've just been watching "9 rules for procedural macros" and my head is still swimming.
@advanceringnewholder
@advanceringnewholder 4 месяца назад
​@@codetothemoonCheering on that. I hope you'll make that video and adding it to the knowledge pool of easy to digest video. Take your time
@glennmiller394
@glennmiller394 Год назад
Thanks!
@codetothemoon
@codetothemoon Год назад
Thanks for watching Glenn!
@pierreniberon1801
@pierreniberon1801 Год назад
Firstly, nice thumbnail, and then, nice video 👍
@codetothemoon
@codetothemoon Год назад
Thanks Pierre!
@jaromor8808
@jaromor8808 Год назад
what's up with that extra/last comma in the dbg! output?
@glebbash
@glebbash Год назад
Great stuff, sounds like macros are not that scary after all.
@codetothemoon
@codetothemoon Год назад
Thanks, indeed they are not! 😎
@advanceringnewholder
@advanceringnewholder 4 месяца назад
I wish you deep dive into procedural macro. I'm having a hard time wrapping my head around it.
@codetothemoon
@codetothemoon 4 месяца назад
yeah i'd love to do this. i actually started writing a video about it awhile back but found it really difficult to present it in a clear way in the RU-vid video format
@artursradionovs9543
@artursradionovs9543 Год назад
Does anyone know how to implement Stripe and JWT in rust for e-commerce
@codetothemoon
@codetothemoon Год назад
I second this. I've been mulling a Stripe video for some time, definitely a huge area of interest. For JWT / OAuth in Rust I actually did a video on that several months ago
@artursradionovs9543
@artursradionovs9543 Год назад
@@codetothemoon no official docs available. I love Rust a lot, but it takes a lot of time as a beginner to pick this up. My goal is to develop a small Android Native App with Actix as a backend framework, but note sure if I will succeed. Rust really is harder than Java, Python or JS.
@alurma
@alurma Год назад
ty
@codetothemoon
@codetothemoon Год назад
you're welcome thanks for watching!
@tsalVlog
@tsalVlog 11 месяцев назад
we call it the mustache brace around here.
@codetothemoon
@codetothemoon 11 месяцев назад
nice! sounds far better than "curly braces"
@Daveiac
@Daveiac Год назад
Is there a way to specify the types of elements to the set? Like what if you were to do set!(1,"2",'3'), would it compile?
@ianakotey
@ianakotey Год назад
Nah, compiler would infer their types are different and reject
@codetothemoon
@codetothemoon Год назад
yeah like Ian mentions, the HashSet itself has to be of a specific type so this wouldn't compile - this isn't related to the macro itself, it would still happen if you tried to do that directly with HashSet::from
@AzureFlash
@AzureFlash Год назад
3:39 Trolling is a art
@codetothemoon
@codetothemoon Год назад
If I trolled it wasn't intentional! 🙃
@grindarius661
@grindarius661 Год назад
What kind of theme are you using? It is so cool and I wanted to know the name of it.
@codetothemoon
@codetothemoon Год назад
Thanks, it's Sonokai!
@arnimlost
@arnimlost Год назад
@@codetothemoon what font are you using?
@kennethbeal
@kennethbeal Год назад
"Aces!" - 16 Candles
@codetothemoon
@codetothemoon Год назад
Hah, I had to look this up!
@narayanbhat3279
@narayanbhat3279 Год назад
shouldn't you first create an empty hashset and then push each of the elements into the set?
@codetothemoon
@codetothemoon Год назад
That would work too. I'm honestly not sure which approach is more efficient.
@eddex.
@eddex. Год назад
Why did the "thing = 5" variable match the "a arm"? And how can it match "a" when there's no variable called "a"?
@theaiguy_
@theaiguy_ 8 месяцев назад
That is because a can be anything, 5 included, so it matches.
@theaiguy_
@theaiguy_ 8 месяцев назад
Usually the general case is named "_", but really can be anything
@kavehtehrani
@kavehtehrani 2 месяца назад
@@theaiguy_ thank you kind stranger!
@ambuj.k
@ambuj.k Год назад
What is your vscode theme in this video?
@codetothemoon
@codetothemoon Год назад
Sonokai
@KyuuKun16
@KyuuKun16 Год назад
Your videos are AMAZING, would you consider making one delving deeper into concurrency?
@codetothemoon
@codetothemoon Год назад
Thanks Jason, I'd love to do one on concurrency - it's already on the video idea list!
@Polynuttery
@Polynuttery 5 месяцев назад
What did you mean that “a” matches on 5 ?
@legends_assemble4938
@legends_assemble4938 Год назад
Can u create a video on getting started with procedural macros.
@codetothemoon
@codetothemoon Год назад
I'd love to do that, and I actually started writing a script on at least one occasion, but I've found them to be incredibly challenging to explain in a simple way. I'll come back to it at some point 😎
@legends_assemble4938
@legends_assemble4938 Год назад
@@codetothemoon Thanks for considering my request 💛💛
@van3ll0pe
@van3ll0pe Год назад
C > rust I love c
@codetothemoon
@codetothemoon Год назад
What do you like most about C that Rust falls short on? What issues do you think C has that could be addressed in a future language?
@not_ever
@not_ever Год назад
@@codetothemoon Rust doesn't segfault enough. A real language segfaults at least three times before breakfast.
@tactics40
@tactics40 Год назад
nit: println takes a string literal, not a slice. One of the hallmarks of a macro is that it can distinguish the two whereas functions can't.
@codetothemoon
@codetothemoon Год назад
Ahh good point I was sort of using those terms interchangeably, but like you say in the world of macros they are different!
@codeplay4947
@codeplay4947 Год назад
What is your color theme
@codetothemoon
@codetothemoon Год назад
Sonokai
@codeplay4947
@codeplay4947 Год назад
@@codetothemoon Do you mean Monokai...I couldn't find Sonokai
@Elduque40
@Elduque40 Год назад
Do you have Rust for beginners?
@codetothemoon
@codetothemoon Год назад
Check out "Rust Demystified"! It goes straight to the heart of what makes Rust different from other languages
@phenanrithe
@phenanrithe Год назад
The best I've read is this book: Programming Rust by Jason Orendorff, Jim Blandy, and Leonora F .S. Tindall, O'Reilly. It covers the last 2021 edition, is superbly written and covers all the topics by explaining everything with a good learning curve. I've heard good things about The Rust Programming Language by Steve Klabnik and Carol Nichols, no starch press, but it's outdated (a new edition should be available later next year).
@banocean
@banocean 6 месяцев назад
Tbh your videos now are kinda let's do thing I can read in the docs/rust book :/
@codetothemoon
@codetothemoon 6 месяцев назад
thanks for the feedback. I only make videos on topics that are covered in the Rust book if I think i can offer a different approach and explanation that makes it easier to understand, which was the case for this video. Another example would be the one on interior mutability. Maybe I missed the mark on this one!
@Singlton
@Singlton 5 дней назад
Bro, your tutoriall are amazing, post discord or telegram groups please♥️🙏
@marcelo55869
@marcelo55869 Год назад
𝓑𝓛𝓐𝓩𝓘𝓝𝓛𝓨 𝓕𝓐𝓢𝓣
Далее
Is Rust the New King of Data Science?
15:38
Просмотров 133 тыс.
rust macros are magic
14:02
Просмотров 45 тыс.
Rust's Witchcraft
9:18
Просмотров 174 тыс.
1 billion row challenge in Rust using Apache Arrow
9:12
Constructors Are Broken
18:16
Просмотров 102 тыс.
Rust Powered Polymorphism ⚡️ With Traits
9:55
Просмотров 92 тыс.
8 deadly mistakes beginner Rust developers make
14:14
Просмотров 158 тыс.
but what is 'a lifetime?
12:20
Просмотров 61 тыс.
The Rust Standard Library is SO Confusing...Until Now!
11:45
Rust Powered Database SurrealDB (It's Pretty Ambitious)
11:28
Rust vs Java: A Staff Engineer's perspective
25:04
Просмотров 10 тыс.
Why Rust is NOT a Passing Fad...
8:54
Просмотров 30 тыс.
Сравнили apple и xiaomi!
0:21
Просмотров 37 тыс.