Writing Unsafe Rust

preview_player
Показать описание
The ultimate Rust lang tutorial. Follow along as we go through the Rust lang book chapter by chapter.

Chapters:
0:00​ Intro
0:27 Unsafe Superpowers
2:32 Dereferencing a Raw Pointer
5:46 Calling Unsafe Function or Method
6:49 Creating a Safe Abstraction
10:35 extern Functions to Call External Code
12:09 Accessing or Modifying Mutable Static Variable
14:02 Implementing an Unsafe Trait
14:19 Accessing Fields of a Union
14:41 When to Use Unsafe Code
14:52 Outro

#letsgetrusty​​ #rust​lang​ #tutorial
Рекомендации по теме
Комментарии
Автор

Never thought I would be remotely consuming this much Rust content in a day, but everything changed after I came across this channel.

obitorasu
Автор

I think there's a lot of misconception concerning unsafe Rust. Using unsafe Rust does not turn off ALL the safety guarantees of Rust. It allows you to perform some tasks and operations that the compiler forbids in safe Rust.
I find a lot of arguments that if I'm going to write unsafe Rust, I might as well use C/C++. While this is not a C++ vs Rust post (and frankly that argument is stupid). All of C++ code is inherently unsafe while unsafe Rust code is safely nested in the unsafe blocks and the rest of the code is safe with all the wonderful safety guarantees.
This aids easy identification of bugs and issues in your code and alerts any users to potential hotspots in the codebase.
You would rarely need to write unsafe Rust even in a large professional code base. And I think unsafe Rust exists for those coming from C/C++ as well as development on embedded devices and OSs where bare metal programming may become necessary

ramesses_ii
Автор

4:21 Directly referring to addresses like this is definitely useful in embedded programming so it’s not a silly example in that context.

Banikan
Автор

Your videos are awesome man.

Thank you for all the work you do for the community!

jonathancamarena
Автор

The raw pointers example at 4:59 fails Miri. I think the issue is that the temporary `&mut num` created on line 5 ends the shared borrow from line 4 and invalidates the *const pointer that's derived from it. You can see the Miri error if you copy the code to the Rust Playground and select Miri under Tools. (Apologies for not just including a link. YouTube seems to delete my comment when I do that.)

oconnor
Автор

I just enjoy the way u add references to ur healthy humour in a very safe way 👌

bjugdbjk
Автор

This video is almost identical with The Rust Programming language book. And well described.

kobruh
Автор

Next, I would like to see a small project which connect these concepts....

PravinKumar-loem
Автор

Fantastic effort.. Makes it very easy for us !!! Thanks Bogden.. LGR !!!

rohitcr
Автор

Hope we can get async rust with tokio tutorial soon!

scotty
Автор

Reverse psychology, very unsafe way to convince me but it worked

pathfinder
Автор

It seems that split_at_mut now is an existing function in latest stable rust release

alexdai_
Автор

unsafe in rust means: Hey compiler, i know what i'm doin', f*ck off and don't error to me.

denizsincar
Автор

unsafe rust vs C ... ??? what would happen ?
is unsafe rust powerful as C ?

monirahmadi
Автор

Yesss love this!! less get rustyyy boi

lidiyapshonyak
Автор

Am I ready to make a Krabby Patty now Mr. Krabs?

NottNott
Автор

Hey There! Love your content! How about opening a discord server?!

bayezidmahmud
Автор

Someone tagged CrowdStrike CEO here please xXD

jayleejw
Автор

is it just me or does the thumbnail gets dumber 😑

gilfoylefromchrissdiscords
Автор

if i want to use unsafe then it's better to use c or c++ why rust???

techlifejournal