Smarter Programming in Rust: Master 'move' Now!

  Рет қаралды 2,888

Flo Woelki

Flo Woelki

Күн бұрын

Understanding what the move keyword in Rust is, is hard. But Rust also has really easy to use one line tricks. If you are interested, I recommend watching this video after understanding the move keyword: • Master Rust File Handl...
📝 Description
Rust's memory management model is unique, and the 'move' keyword is at its core. Are you ready to take your Rust programming to the next level? In this video, we'll demystify the 'move' keyword and help you write more efficient, safer, and more predictable Rust code.
This video will cover the fundamentals of 'move' semantics, showing you how 'move' transfers ownership to prevent memory errors and double-frees. We'll explore practical examples, demonstrating 'move' in action within real-world code. Finally, we'll discuss the performance implications, covering how using 'move' effectively can improve your program's speed.
Important Note: using `.unwrap` without proper error handling is not recommended and should be avoided. I only use `.unwrap` for demonstration purposes in this video.
⏳ Timestamps:
00:00 - Introduction
00:53 - Simple Example
06:00 - Leptos Example
08:48 - Outro
🔗 Important links:
Documentation: doc.rust-lang.org/std/keyword...
👋 Hey there!
If you are new to this channel: Hey 👋 my name is Flo and I am a professional software engineer with a passion for coding in Golang, TypeScript, JavaScript, and Rust. This channel is where I share that passion and dive into the exciting world of software engineering. Plus, I love using Emojis and paper-based animations (so have a look for that, if you want to find my videos).
📨 Support and Connect!
Buy me a coffee: www.buymeacoffee.com/florianw...
Become a member: www.youtube.com/@flowoelki/me...
Discord: / discord
Instagram: / flowydev
LinkedIn: / florian-woelki
TikTok: / florianwoelki
GitHub: github.com/FlorianWoelki
#Rust #Move #Leptos

Пікірлер: 9
@JC-wj5ks
@JC-wj5ks Ай бұрын
I actually came to this video from using Leptos. It still not clear to me how leptos manages to use the move keyword all over the components and not run into borrowing/ownership issues.
@FloWoelki
@FloWoelki Ай бұрын
Awesome! :) Maybe for clarification: the `move` keyword is the whole magic and this is explained in this video. `move` is not a Leptos concept and it's used to transfer ownership of variables to a closure.
@BharadwajAvva
@BharadwajAvva 21 күн бұрын
KZfaq deosn't support speeding the video beyond 2x.
@Fantaztig
@Fantaztig 6 ай бұрын
To stay within the second example: How would I implement multiple event listeners that access the same element? Is this already part of your non-recommendation, meaning there is already a better solution? :)
@FloWoelki
@FloWoelki 6 ай бұрын
thank you for the question. one solution would be to just cloning the reference. however, this will have some problems in the future if you just clone a primitive variable. that's why a common way is to use reference counting (using e.g., `Arc` in Rust). this gives you the correct reactivity. i'll probably make a video about that as well. i hope that helps :)
@Fantaztig
@Fantaztig 6 ай бұрын
@@FloWoelki Oh I see, Arc is an explicit thread safe pointer, nice! Thanks, yeah I have not yet had the chance to start out with rust but I'm trying to understand the syntax and stuff haha :)
@FloWoelki
@FloWoelki 6 ай бұрын
exactly. Arc is thread safe (compared to Rc) and is a smart pointer. Rust has a steep learning curve but is a lot of fun :D
@davidbriggs8109
@davidbriggs8109 Ай бұрын
@@FloWoelki the steep learning curve is not that high than c++ smart pointer 😂
@FloWoelki
@FloWoelki Ай бұрын
@@davidbriggs8109 true fact :D
Master Rust File Handling in One Line
6:39
Flo Woelki
Рет қаралды 1,4 М.
The Secret to Rust Ownership: Rc vs. Arc
13:47
Flo Woelki
Рет қаралды 2,1 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 198 МЛН
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 35 МЛН
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
МЯТНАЯ ФАНТА
Рет қаралды 8 МЛН
Golang: The Last Interface Explanation You'll Ever Need
17:58
Flo Woelki
Рет қаралды 4,4 М.
Mojo Is FASTER Than Rust
19:22
ThePrimeTime
Рет қаралды 113 М.
8 deadly mistakes beginner Rust developers make
14:14
Let's Get Rusty
Рет қаралды 161 М.
Simple GUI application with Slint and Rust
23:59
Slint
Рет қаралды 28 М.
This is your last video about Golang Structs!
15:57
Flo Woelki
Рет қаралды 2,2 М.
Self-referential structs (in Rust)
27:21
fasterthanlime
Рет қаралды 52 М.
Why HTMX and Golang? The answer might surprise you...
12:04
Flo Woelki
Рет қаралды 5 М.
Will Rust Beat JavaScript in 2023?
23:48
ThePrimeTime
Рет қаралды 109 М.
Unreasonably Easy Console Apps in Rust
1:54:16
Tsoding Daily
Рет қаралды 93 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 140 М.
Хакер взломал компьютер с USB кабеля. Кевин Митник.
0:58
Последний Оплот Безопасности
Рет қаралды 2 МЛН
iPhone 15 Pro Max vs IPhone Xs Max  troll face speed test
0:33
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 6 МЛН