Rust: Managing a Growing Project

preview_player
Показать описание
Getting features out faster sometimes means sacrificing things like project organization. Further enhancements to your project start to slow down and changing behavior gets harder and harder to do.

Rust lets you split a package into multiple crates and a create into modules.

By managing a project in Rust, we will take a look at packages, crates, and modules.

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

Hi Ricky, I watch every day one of your videos before starting to work with my morning coffee. You are so sympathetic and knowledgeable!
Thanks a lot for the content!

DSaad
Автор

Your content is too professional for a channel with 400 subs. You deserve atleast 25K. Great job!

dyspatch
Автор

I was hoping this video went into additional examples and explanations instead of reiterating the content that's in the rust lang book.

blackbomb
Автор

In my project I had to keep everything inside the "src" folder, without any more nesting. Because when there were more nests, the local code worked normally, but in my github actions jobs it gave an error that didn't find the imports...

glener
Автор

What plug-in gives you that yellow line underneath your “mod” definition and the down the left side?

tylerbunnell
Автор

If I understand correctly:

use crate::xxx.yyy;
use super::xxx.yyy;
use self::xxx.yyy;

Is intended for code within your create itself:.
When you use crates outside your code you just use
use :xxx.yyy;

And specify it in the cargo

[dependencies]
xxx = { path = "../xxx"}

New to Rust and I was convinced that use crate::xxx was intended for code that was in a different crate to point to code in that different crate. Lost many hours with trial and error until I found this post :-)

olafbaeyens
Автор

Something else that is confusing from someone that is coming from another language:

use crate::xxx.yyy;
use super::xxx.yyy;
use self::xxx.yyy;

"super" and "self" is not what you expect how it behaves.
When you look at the folder structure then the file is at the same level as your source code and you want to use:.

use self::xxx.yyy;

However you need to use instead.

use super::xxx.yyy;

Probably because in Rust your filename is also a namespace deeper.
Most other languages, the filename itself is not part of a namespace but in Rust it is

olafbaeyens