Rc and Arc are two magic and powerful methods of taming Ownership in Rust. Next to this complexity, 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 Handling in One Line
Description
Discover the ins and outs of Rust's powerful reference counting mechanism with Rc and Arc in this comprehensive video. Join me as we delve into the world of memory management in Rust and explore how Rc and Arc enable efficient memory sharing and prevent memory leaks. We'll cover the differences between Rc and Arc, their use cases, and best practices for leveraging them in your Rust projects.
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
01:44 Nonworking example
04:28 Rc Example
10:07 Arc Example
13:23 Outro
Important links:
Rust Rc: https://doc.rustlang.org/std/rc/stru...
Rust Arc: https://doc.rustlang.org/std/sync/st...
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 paperbased animations (so have a look for that, if you want to find my videos).
Support and Connect!
Buy me a coffee: https://www.buymeacoffee.com/florianw...
Become a member: https://www.youtube.com/@flowoelki/me...
Discord: / discord
Instagram: / flowydev
LinkedIn: / florianwoelki
TikTok: / florianwoelki
GitHub: https://github.com/FlorianWoelki
#Rust #Arc #Rc #ReferenceCounting #MemoryManagement