Skip to content
0:00 / 0:00

#unsaferust#vec#allocator

Implementing Rust's Vec From Scratch

Ryan Levick

14K subscribers • 3 videos on Hallway

YouTube

Advanced. Deep dive for people who know the field.

33K views5 years ago2 recommendations

Programming languagesSystems programmingRustMemory managementData structures

Ryan Levick implements a simplified version of Rust's Vec type from scratch to explain unsafe Rust and memory management.

In this stream, we implement a limited version of Rust's Vec type from scratch. In doing so, we learn a lot about unsafe Rust. This stream is geared towards those with at least intermediate experience in Rust, but beginners should also learn more about how Rust's memory model works. Note: This is just a learning exercise! The standard library's Vec is great, and you should just use that. The resource on covariance I mention in the stream can be found here: github.com/sunshowers/lifetime-variance-example

Why it's here

2 people recommend this

What people say. Recommended as an excellent deep dive into unsafe Rust, memory allocation, and standard library internals.

u/WrongJudgment6in r/rust • Recommends

On “What is your favorite video/talk about Rust?”

In no particular order On testing Building Reliable Infrastructure in Rust by Tyler Neely On API design Type-Driven API Design in Rust by Will Chricton History and design of Async Await over it's inception Rust's Journey to Async/Await by Steve Klabnik Part 2 of sorts The Talk you've Been Await-ing For by Steve Klabnik On data structures from scratch Implementing Rust's Vec from Scratch by Ryan Levick

u/1668553684in r/rust • Recommends

On “How unpleasant is Unsafe Rust?”

…in Rust it might be a few lines in an entire project, or even none at all. To finish off, here's a great video (one of my favorites) by Ryan Levick as he goes through implementing `Vec`. It's not a guide to unsafe code or anything, but it's interesting to see all of the things you have to consider and how to deal with them, well worth the watch: link to this video…