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.
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
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.
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...
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!
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!
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
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 UA-cam video format
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
@@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.
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 😎
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
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).
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!
Assigning "Bob" to variable "a" and "Alice" to variable "b" is just evil
Lol😂
It’s an sql relationship 🤫
hah, in retrospect that was a poor choice 🙃
It's a quantum teleportation 🤣
I was going to comment the same thing lol
I definitively love your style. Clear, short, on-topic!
Thanks Robin!!
This is the best rust macro video on UA-cam! Looking forward to all your future videos your quickly brecoming an industry leader
wow thanks for the kind words! I really enjoy making them!
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.
ahh didn't know about this, thank you!
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
That was a really good, light introduction into Rust's declarative macros. Thanks!
Thanks AceofSpades! It's almost as if the title and thumbnail were speaking directly to you 🙃
Found an interesting syntax today, which is tuple pattern matching, where all elements of the tuple value can become 'wildcard' matches / variables'.
I find this feature super handy, I think it's called "destructuring"!
@@codetothemoon - yeah, it's destructuring, but never seen it before in this context (matching).
love your explanation style, simple, clear and well structured
Thanks Tryo!
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.
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...
Your Rust content its been incredible useful! Thank you!
Thanks Eduardo, thanks for watching!
Hey remember you can use the rust language reference to help under stand the token syntax of a macro!
Agree, it's a great resource!
I have to say, you really got the best Rust content. exactly the right tempo and right hints
thanks so much!
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
Thanks Zah, more are on the way!
Loving these Rust videos so much, great to follow along and learn something new :) Keep them coming!
Thanks Noxdor, glad you are finding them valuable! more to come!
Really cool way to explain. Thanks for taking time to make awesome videos.
Thanks for watching Akshay!
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!
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!
@@codetothemoon yeah! I've just been watching "9 rules for procedural macros" and my head is still swimming.
@@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
Great introduction!!! It would be cool if you did one or a few follow ups of more advanced macros.
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
Man, you should have "in-depth rust" series
would love to make such a thing!
Great stuff, sounds like macros are not that scary after all.
Thanks, indeed they are not! 😎
I wish you deep dive into procedural macro. I'm having a hard time wrapping my head around it.
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 UA-cam video format
Great concise content. Rust to the moon 🙂
Thanks Tuan! 🌙
Lovely video! Love your pacing
Does anyone know how to implement Stripe and JWT in rust for e-commerce
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
@@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.
3:39 Trolling is a art
If I trolled it wasn't intentional! 🙃
Love the way you teach us ,thank❤❤
Your videos are AMAZING, would you consider making one delving deeper into concurrency?
Thanks Jason, I'd love to do one on concurrency - it's already on the video idea list!
Firstly, nice thumbnail, and then, nice video 👍
Thanks Pierre!
Why did the "thing = 5" variable match the "a arm"? And how can it match "a" when there's no variable called "a"?
That is because a can be anything, 5 included, so it matches.
Usually the general case is named "_", but really can be anything
@@theaiguy_ thank you kind stranger!
It was cool! Thanks
Thanks for watching Ozkavosh!
we call it the mustache brace around here.
nice! sounds far better than "curly braces"
Can u create a video on getting started with procedural macros.
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 😎
@@codetothemoon Thanks for considering my request 💛💛
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.
Ahh good point I was sort of using those terms interchangeably, but like you say in the world of macros they are different!
ty
you're welcome thanks for watching!
C > rust
I love c
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?
@@codetothemoon Rust doesn't segfault enough. A real language segfaults at least three times before breakfast.
Awesome 🙌🙌
glad you found it valuable!
"Aces!" - 16 Candles
Hah, I had to look this up!
shouldn't you first create an empty hashset and then push each of the elements into the set?
That would work too. I'm honestly not sure which approach is more efficient.
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?
Nah, compiler would infer their types are different and reject
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
what's up with that extra/last comma in the dbg! output?
Great stuff!
Thanks Matthew!
Thanks!
Thanks for watching Glenn!
What is your vscode theme in this video?
Sonokai
What kind of theme are you using? It is so cool and I wanted to know the name of it.
Thanks, it's Sonokai!
@@codetothemoon what font are you using?
What is your color theme
Sonokai
@@codetothemoon Do you mean Monokai...I couldn't find Sonokai
Do you have Rust for beginners?
Check out "Rust Demystified"! It goes straight to the heart of what makes Rust different from other languages
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).
Tbh your videos now are kinda let's do thing I can read in the docs/rust book :/
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!
Bro, your tutoriall are amazing, post discord or telegram groups please♥️🙏
𝓑𝓛𝓐𝓩𝓘𝓝𝓛𝓨 𝓕𝓐𝓢𝓣