File:Crust of Rust- Smart Pointers and Interior Mutability.webm
Summary
Description |
English: 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 (https://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 https://gist.github.com/jonhoo/7cfdfe581e5108b79c2a4e9fbde38de8 and the Discord at https://discord.gg/RJdqQ9n 0:00:00 Introduction 0:01:11 Discord 0:02:31 Agenda 0:03:50 Interior Mutability 0:07:47 Cell 0:23:39 Trying to Test Cell 0:40:17 UnsafeCell 0:41:21 RefCell 0:54:21 RefCell Smart Pointer 1:06:27 Rc (reference counted ptr) 1:23:49 NonNull 1:31:55 PhantomData and Drop Check 1:44:25 ?Sized Briefly 1:47:30 Thread Safety 1:54:20 Copy-on-Write (Cow) You can watch the live version with comments at https://www.youtube.com/watch?v=1e5aDptlGoI |
Date | |
Source | YouTube: Crust of Rust: Smart Pointers and Interior Mutability – View/save archived versions on archive.org and archive.todayCategory:Media from YouTube |
Author | Jon Gjengset |
Licensing

- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
![]() |
This file, which was originally posted to an external website, has not yet been reviewed by an administrator or reviewer to confirm that the above license is valid. See Category:License review needed for further instructions. |