Crust of Rust: Smart Pointers and Interior Mutability

Jon Gjengset
Jon Gjengset
123.4 هزار بار بازدید - 4 سال پیش - In this fourth Crust of
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/nom...) 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/7cfdfe... and the Discord at Discord: discord

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 Crust of Rust: Smart Pointers and Int...
4 سال پیش در تاریخ 1399/03/28 منتشر شده است.
123,469 بـار بازدید شده
... بیشتر