Deref Trait | Rust Language

Описание к видео Deref Trait | Rust Language

Use the Deref trait - Ch 15 from the Rust Docs. In this video I do a fresh code example to demonstrate how to dereference a "Car" struct that contains a generic type T.

Dereferencing smart pointers is necessary to interact with the underlying data they encapsulate. It allows you to access, transfer ownership, invoke methods, and borrow the data according to the specific behaviour and guarantees provided by the smart pointer.

! Note, my instance of Car was called box_car, this name was from earlier code, it's not a Box, it's just a name.

Chapters -
00:00 intro
01:00 code examples
03:06 smart pointer to the Box
04:02 main code
06:44 impl the Deref trait
12:00 Rust docs

Link to run the code Rust Playground
---------------------------------------------------------------
🟩 https://play.rust-lang.org/?version=s...

Linux Hosting - VPS server - Webdock
----------------------------------------------------------------
🟩 Webdock Linux Hosting : https://webdock.io/en?maff=wdaff--170

Nostr
---------
@RngWeb
[email protected]

https://findthatbit.info/
https://redandgreen.co.uk/

#rustlang #dereference #iterator

Комментарии

Информация по комментариям в разработке