Pointers In Rust || A Rough Tutorial

  Рет қаралды 373

Dude Bro

Dude Bro

Жыл бұрын

Today I discovered how pointers really work in Rust! So I decided I'm gonna share my example with you guys.

Пікірлер: 9
@DudeBroVideos
@DudeBroVideos Жыл бұрын
Apologies on the quality of the recording, I was zoomed out a bit on the terminal and I will do better next time!
@karthikeyanvj
@karthikeyanvj 2 ай бұрын
nice one!! thank you!
@DudeBroVideos
@DudeBroVideos Ай бұрын
It looks like this video caught the algorithm! If anyone wants to hear a very without all the "umm"s and "uhh"s then make sure to check out my less scuffed version on my other channel! kzfaq.info/get/bejne/at2SdcqT1NnZlI0.html
@lukasloen4659
@lukasloen4659 Ай бұрын
using raw pointers for this is a pretty bad idea, given that they're allowed to be dangling, so if a user is ever dropped or moved in memory, that pointer won't point to them anymore, and dereferencing them would be a read after free error, and casting them to a reference creates undefined behavior as the compiler assumes that references are always valid. that's why dereferencing them requires unsafe, you have to uphold the rules, not the compiler.
@DudeBroVideos
@DudeBroVideos Ай бұрын
Looks like my video got through on the algorithm, you are absolutely right about this! This is quite frankly a very crude way of going about this but also a rather straightforward one as well. There are other ways of achieving the same thing without the "unsafe" block but still leak memory nonetheless like the Rc method using mutable borrows.
@fredhgl
@fredhgl Ай бұрын
What IDE and plugins r u using? Thanks in advance
@DudeBroVideos
@DudeBroVideos Ай бұрын
I'm not using an ide but I have configured Neovim with vim-plug. Currently the important plugins I'm using are coc, bufferline, lualine, and neo-tree. Some of those have other plugins you have to add in order for them to work but that's the basic rundown.
@gustavojoaquin_arch
@gustavojoaquin_arch 28 күн бұрын
Why you didn't use the native built-in lsp ​@@DudeBroVideos
@hanyanglee9018
@hanyanglee9018 Ай бұрын
Basically, a ref is a ptr with a lifetime. This solution doesn't look useful in real cases. Maybe we need another video?
Smarter Programming in Rust: Master 'move' Now!
9:06
Flo Woelki
Рет қаралды 2,5 М.
Box / Rc / Arc / Mutex - Smart Pointers Simplified - Rust
23:39
Bocksdin Coding
Рет қаралды 11 М.
That's how money comes into our family
00:14
Mamasoboliha
Рет қаралды 9 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
ОСКАР vs БАДАБУМЧИК БОЙ!  УВЕЗЛИ на СКОРОЙ!
13:45
Бадабумчик
Рет қаралды 4,5 МЛН
Rust Functions Are Weird (But Be Glad)
19:52
Logan Smith
Рет қаралды 129 М.
Smart Pointers in Rust - Interior Mutability
17:04
Let's Get Rusty
Рет қаралды 40 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 138 М.
Factorio teaches you software engineering, seriously.
21:27
Tony Zhu
Рет қаралды 1,4 МЛН
The Secret to Rust Ownership: Rc vs. Arc
13:47
Flo Woelki
Рет қаралды 1,7 М.
Jonathan Blow on why C++ is a bad language for games
13:45
Jonathan Blow Highlights
Рет қаралды 46 М.
Rust Allocators and Memory Management
43:51
Michael Mullin
Рет қаралды 9 М.
The Box Smart Pointer in Rust
12:18
Let's Get Rusty
Рет қаралды 68 М.
Rust Demystified 🪄 Simplifying The Toughest Parts
14:05
Code to the Moon
Рет қаралды 174 М.
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 29 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 1,7 МЛН
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 2,1 МЛН
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 7 МЛН