Rust Programming Tutorial #17 - Structs

preview_player
Показать описание
In this video I take you through how you can create and use your own structs in Rust.

Structs allow you to group similar pieces of information together to make a new simple data type you can then use later on.

It can make your code much cleaner and easier to read.

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Good video, but I was flabbergasted when I saw you were using light mode😭

gabrielmendietahernandez
Автор

The color he used in his example is best described as hot pink.

kyleeames
Автор

Thanks for making this tutorial series
Love it :-)
Question, is there any good UI lib/frameworks you have used with rust ?
Native or similar to electron (where rust is backend instead of nodejs)

voffknur
Автор

Very nice tutorials for rust. Could you go in a more advanced tutorials ?

theboogymaster
Автор

Hey man thank you for these rust videos. And I understand your videos ("I don't speak English") but still. So if you have knowledge, can you make an arm programming video with rust? thank you again

batanyaedits
Автор

Question concerning structs and mutability: is it possible to make some of the fields in a struct mutable while keeping others immutable? Not sure what the use case would be, but it was a question that crossed my mind none-the-less.

DirtPoorWargamer
Автор

Hmmm... thanks, but that leaves me with more questions than answers... e.g. what if, taking your example, you only wanted blue to be mutable? possible?

ianh
Автор

probably worth mentioning that there's no rule that the fields in a struct need to all be of the same type
so this should be fine:
struct Person{
name: String,
age: u8,
owns_a_goldfish: bool,
}

samdavepollard
Автор

For defining structs you don't have to get outside of the main function, it is just about scope.

NouifrUIwefdf
Автор

Is it important put the word "struct" all the time before their name?

larissavieiradias
Автор

common #[derive()] used on struct, enum

#[derive(Debug, Default, Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash)]

igorsilva