In this video we implement a Double Linked List in Rust by working with the Weak Smart Pointer and Reference Counters. Similar to several other videos I implemented on the binary tree algorithms, in order to share pointers we make use of the Reference Counter to store a reference to the head and tail of the linked list. The double linked list allows us to point to a previous value in the list as well. However, in order to point to the previous item in the list we must avoid reference cycles and memory leaks by making use of Weak Smart Pointers. We learn about how to properly downgrade and upgrade a weak reference in order to work with the underlying data and I discuss the use of null pointer optimizations and the drop trait to properly clean up our list.
↠ Other Videos to Watch
Tree Traversals with Reference Counting and Interior Mutability (in Rust): [ Ссылка ]
Handling Reference Cycles (in Rust): [ Ссылка ]
↠ References:
Double Linked List: [ Ссылка ]
Rc::downgrade: [ Ссылка ]
alloc::rc::Weak: [ Ссылка ]
Reference Cycles: [ Ссылка ]
Interior Mutability: [ Ссылка ]
Reference Counters: [ Ссылка ]
Drop Trait: [ Ссылка ]
std::cell: [ Ссылка ]
Borrow Trait: [ Ссылка ]
Pointers: [ Ссылка ]
↠ Dotfiles: [ Ссылка ]
↠ Twitter: @nyxtom [ Ссылка ]
↠ Channel: [ Ссылка ]
Cheers! 🍻
🦀 #rust #rustlang #rustprogramming #exercises #programming
Rust Programming Exercises: Double Linked List
Теги
rustrust langrust programmingrust programming languagerust languageexercisesleetcoderustrust tutorialprogramming exercisesalgorithmsalgorithms in rustrust algorithmsreference cycleshandling reference cycles in rustweak references in rustweak smart pointers in rustreference countersreference counters in rustsmart pointers in rustsmart pointersdrop trait