u/MrTact_actualin r/rust • Recommends
On “When should I use Box, Arc, Rc, Cell and RefCell? Can someone tell me if my usage of these things is correct? I'm trying to measure my understanding of these things as well as my knowledge on borrowing.”
111K subscribers • 38 videos on Hallway
Advanced. Deep dive for people who know the field.
163K views6 years ago7 recommendations
Programming languagesSystems programmingRustMemory management
Jon Gjengset re-implements Cell, RefCell, and Rc from scratch to explain smart pointers and interior mutability in Rust.
In this fourth Crust of Rust video, we cover smart pointers and interior mutability, by re-implementing the Cell, RefCell, and Rc types from the standard library. As part of that, we cover when those types are useful, how they work, and what the equivalent thread-safe versions of these types are. In the process, we go over some of the finer details of Rust's ownership model, and the UnsafeCell type. We also dive briefly into the Drop Check rabbit hole (doc.rust-lang.org/nightly/nomicon/dropck.html) before coming back up for air. This is definitely a more technically advanced stream than some of the earlier ones, and may be a little harder to follow. I apologize for that in advance! Please do leave questions here or on Discord and I'll try to help explain what's going on. You can find the final code at gist.github.com/jonhoo/7cfdfe581e5108b79c2a4e9fbde38de8 and the Discord at discord.gg/RJdqQ9n Introduction Discord Agenda Interior Mutability Cell Trying to Test Cell UnsafeCell RefCell RefCell Smart Pointer Rc (reference counted ptr) NonNull PhantomData and Drop Check ?Sized Briefly Thread Safety Copy-on-Write (Cow) You can watch the live version with comments at youtube.com/watch?v=1e5aDptlGoIWhat people say. Highly recommended by the community as an essential deep dive for understanding Rust's smart pointers, ownership, and interior mutability.
u/MrTact_actualin r/rust • Recommends
On “When should I use Box, Arc, Rc, Cell and RefCell? Can someone tell me if my usage of these things is correct? I'm trying to measure my understanding of these things as well as my knowledge on borrowing.”
u/TinBrynin r/rust • Recommends
On “Hey Rustaceans! Got a question? Ask here (6/2023)!”
u/phazer99in r/rust • Recommends
On “Common idioms”
u/davidhuculakin r/rust • Recommends
On “I'm a C++ Programmer trying to learn as much Rust as I can in 5 days.”
u/thvdburgtin r/rust • Recommends
On “What does 'Rc<T> allows only immutable borrows checked at compile time' mean?”
u/wombathqin r/rust • Recommends
On “[Beginner Question] Why and how do we use the heap memory / boxes”
u/rnottakenin r/rust • Recommends
On “Gave up before shipping a single useful rust app due to high learning curve. Advice?”
u/ColdHotdogInhalerin r/rust • Mentions
On “Is UnsafeCell a special magical type known to compiler?”