Intro to Rust-lang (Modules and Lifetimes)

preview_player
Показать описание
In this video, we look at the Rust Module system and the unique concept of the lifetime system in the rust programming language.

Feel free to donate:
BTC: 1ExBSiaEa3pceW98eptJwzR9QHrYZ71Xit
ETH: 0xE448a8DDA5886C49d35B191B2F20630c103024c8
LTC: LXsKxF5JhmMtKgqfcUFdvcXVwiaSqxN9cP

Рекомендации по теме
Комментарии
Автор

"Now let's talk about lifetimes" is at 8:14 -- and it taught me everything I needed to know. Great video.

nandoflorestan
Автор

Watching this course right now. Very helpful. Just what I needed: not for beginners and only about language

axea
Автор

I've checked out several videos and articles on lifetimes before but your video has the best explanation by far and I am finally confident that I understand the concept now. Thank you so much!

meiamavice
Автор

Thank you for this awesome video. Have you stopped using Rust, or are you just more interested in teaching other things right now? I would definitely appreciate more Rust videos in the future. :)

WorstDeveloper
Автор

Can you elaborate this example, with another example which makes one var a reference from another class string. So when one change value the other reference change.

jalankoe
Автор

Hi Tensor, I found that the following 2 functions also work without specifying the lifetime parameter explicitly.

fn pt(x: &str) -> &str {
let v = "adff";
return v;
}


fn pp(x: &str) -> &str {
if x.len() > 3 {
return x;
}
let v = "hello";
return v;
}


Does it mean the compiler assumes the returned reference has the same lifetime of the parameter x? I find it this quit strange, are there any reason?

kitgary
Автор

I just don't get this decision by the Rust devs, to have 1 file be a module.
Correct me, if i got it wrong.
The Go package semantics seem to have gotten it right.
What if you have a lot of definitions of structs and logic and you want to put your structs in a separate file.
You want them to be in the same module but you don't want to have a 2 thousand line file.

ovndfbs
Автор

Thank you for the video! I have a question about modules though. Having a file structure like this:
main.rs
C.rs
A/mod.rs
A/B.rs
How do I use code from A or B modules inside the C module? Or maybe I should not structure my code like that at all?

misliclc
Автор

Wild shot here, but what's the chances of zooming the screen in on your tutorials? I like to watch these videos on my phone while on the treadmill

simonwtong
Автор

I understand nothing, read both rust online books first/second edition, mastering rust and programming rust about lifetimes, my understanding of lifetimes is zero
I guess i will need a new language i cant find a way to use pass references at all it simply isnt working and ive ran out of resources to read.

yiandev
Автор

After i have doing Rust for couple of months, i don't really like the different semantics over the use statement.
I think it's a mistake to have different language semantics based on where a module comes from.

You should have "use" and then the thing you want.
Everything else is unnecessary complexity.
Bu then again, C++ is a complete mess and it's still popular.

ovndfbs
Автор

It would be more clear if you use a real example, as oppose to a.b.c.d.e .

ovndfbs
Автор

How ugly the life time looks! I feel they want to hide the complexity of the pointer/reference/heap and ended up pushing out another weird thing.

elgs