Rust Linz, July 2021 - Rainer Stropek - Traits, not your grandparents' interfaces

  Рет қаралды 34,066

Rust

Rust

Күн бұрын

Пікірлер: 43
@CompletelyCovered3
@CompletelyCovered3 3 жыл бұрын
Rainer seems like a great guy. Helpful, clear, and humble.
@建平許
@建平許 3 жыл бұрын
Awesome! The speaker has a great passion for Rust.
@nirmalyasengupta6883
@nirmalyasengupta6883 Жыл бұрын
Yes, the passion is showing. Great.
@pyrysaarinen4954
@pyrysaarinen4954 2 жыл бұрын
This is the most enthusiasm i Have ever seen for someones cause
@yapayzeka
@yapayzeka Жыл бұрын
15:30 according to Rust docs; use From for imlementation and use Into for trait bounds. Examples: Implementing From you can see in the video: impl From for SquareContent { ... } Trait bounds for Into only accepts parameters that are castable to SquareContent. we implemented From earlier so we can pass u8 because we know how to make SquareContent from u8; fn my_super_function(param: T) -> SquareContent where T: Into, { ... }
@9SMTM6
@9SMTM6 3 жыл бұрын
Nice so far. Just a small nitpick, at 13:20: Pretty sure that "Auto-Implementation" is already (pretty much) used for something else, and even ignoring that thing there's other mechanisms that could be named the same. Auto-Trait-Implementations is reserved for things that a user usually doesn't interface with directly, stuff like Sync (which gets imemented automatically on any type that is made up out of elements that implement Sync), Send etc. These get implemented entirely without user interaction, while the things refered to in the talk still need to be explicitly opted in, even if that is with minimal boilerplate. These traits refered to in the talk, eg Clone, Copy, Hash etc, are called "Derivable traits". There's also YET ANOTHER mechanism, called "Banket Implementations". These are also powerful and interesting. One example is the Conversion Traits "From" and "Into", which can handle eg conversions between &str and String. As the documentation of these mentions you usually only want to Implement "From" on the target type, this will automatically create an implementation of "Into" on the source type via Blanket Implementation. So, if you implement "From for String" the compiler will generate a perfect implementation of "Into for &str".
@2002budokan
@2002budokan 2 жыл бұрын
The essential ideas behind the traits are explained by a passioned developer. Thank you, this is the first time that I see a trait is more than an interface.
@robinmoussu
@robinmoussu 2 жыл бұрын
I love your energy Rainer. That’s a great talk that I will recommend.
@irlshrek
@irlshrek 2 жыл бұрын
loved this! genuinely helped me understand traits better
@sumansaha295
@sumansaha295 2 жыл бұрын
This is a very in-depth video about rust features. Thanks!
@willinton06
@willinton06 3 жыл бұрын
Rust is so ahead of the curve, as a C# guy I’m kinda jealous
@SimonClarkstone
@SimonClarkstone 3 жыл бұрын
I'm a C# and Java programmer, and I would like to use them too. As one of the attendees pointed out, Rust traits are similar to typeclasses in Haskell, which have been around since the 90s at least. (I am familiar with them in Haskell.)
@marko-lazic
@marko-lazic Жыл бұрын
Thank you so much. I filled some gaps about traits by watching the video.
@thalianero1071
@thalianero1071 2 жыл бұрын
I’d like to take a moment to say that a tied tic-tac-toe match is called a “cat’s game”
@frroossst4267
@frroossst4267 11 ай бұрын
This is an absolutely amazing talk!
@nickschmitt8594
@nickschmitt8594 3 жыл бұрын
What an incredible educator.
@Amapramaadhy
@Amapramaadhy Жыл бұрын
I was confused by the `From`/`into` until it dawned on me that you are _not_ doing a reverse operation! It was subtle for me. Using pseudo-code, `Widget::From(1)` can simply be re-stated as `1.into()` which returns the same widget. This way, its a different syntax for writing the same thing that can come handy in some situation, e.g more ergonomic api with chained operation. (This would be very different from say `Widget.into()` to return a 1 but thankfully thats not whats happening here. )
@Gruby7C1h
@Gruby7C1h Жыл бұрын
Exactly, having "impl From for Sausage" doesn't magically implement a conversion that would allow us to make the poor pig back from our meal.
@luizchagasjardim
@luizchagasjardim 3 жыл бұрын
Oh, man. I need to learn German to understand traits? XD Just kidding. Awesome talk. I would recomend it to all people looking into learning Rust.
@saaddahmani1870
@saaddahmani1870 2 жыл бұрын
Awesome explanation for C# coming developers... from C# developer !!.
@sbrugby1
@sbrugby1 3 жыл бұрын
Strong Christolph Waltz vibes
@Raleighthrbub123
@Raleighthrbub123 2 жыл бұрын
Well, he's Austrian so that would make sense. Excellent energy. Really commands your attention and makes you hyped (or scared) lol.
@peter9477
@peter9477 2 жыл бұрын
That feeling when Dr. Schultz is teaching you Rust...
@ikhlasulkamal5245
@ikhlasulkamal5245 Жыл бұрын
Wait, did you said Ferris cake? I want one please
@Zaniahiononzenbei
@Zaniahiononzenbei 2 жыл бұрын
I'm definitely confused with implementing into_iter. I'm understanding that you can add "parameters" to interfaces in some sense. Essentially, only as types. All I can see from the example is a daunting pile of various versions of "into" and "iter", with various joining characters. It makes sense to inform the compiler that the calling code will get an item of a specific type when iterating. It makes sense to reuse the into_iter implemented on an array. I'm having difficulty understanding the function. If I'm understanding the code right, we're saying we're going to return the same type that calling into_iter on an array of length 9 would return? Are these identical? IntoIterator::Into_iter(self.board_content) self.board_content.into_iter()
@piguyalamode164
@piguyalamode164 Жыл бұрын
Yes, IntoIterator::Into_iter(self.board_content) and self.board_content.into_iter() should be identical identical(as well as Self::into_iter(self.board_content), and ::into_iter(self.board_content) I believe)
@joelmontesdeoca6572
@joelmontesdeoca6572 2 жыл бұрын
What a mind blowing talk!
@erc_io
@erc_io 2 жыл бұрын
Can someone give me the German at 33:16 when talking about From implying Into?
@robert36902
@robert36902 Жыл бұрын
"Eine Fähigkeit auf Basis eine anderen Fähigkeit ableiten" is what it sounds like to me. To derive a trait based on another trait, or something like that.
@victorfds
@victorfds 2 жыл бұрын
The speaker is awesome. 🤓. I really liked the code examples.
@kamilzielinski504
@kamilzielinski504 Жыл бұрын
very good examples
@i.8530
@i.8530 2 жыл бұрын
Great talk, I learned a lot from it!
@JohnPywtorak
@JohnPywtorak Жыл бұрын
Hi great talk, thank you. Small thing at 18:00, not really automatic magic, more fully qualified syntax since default doesn't have a Self receiver as I just learned. It threw me and I didn't understand other than the obvious thing happening. It is like ::default().
@func0der
@func0der 2 жыл бұрын
Thank you very much for this very clear talk.
@mario7501
@mario7501 Жыл бұрын
Great talk! I like to always include the return statement though. It makes code more readable I think.
@user-jt7wb3zc1m
@user-jt7wb3zc1m 2 жыл бұрын
Cool! Amazing talk! 🦀
@СергеичЪФ
@СергеичЪФ 3 жыл бұрын
Good!
@jensen7141
@jensen7141 3 жыл бұрын
👏👏👏
@brogen100
@brogen100 3 жыл бұрын
I want to double like
@nteasushz
@nteasushz 3 жыл бұрын
🍺
@theimmortalsinger3762
@theimmortalsinger3762 10 ай бұрын
"let me just say one sentence in german so that the whole audience gets it." Says it. Doesn't translate. Wut?
@hanyanglee9018
@hanyanglee9018 6 ай бұрын
42 Comments 😆
@sergesolkatt
@sergesolkatt Жыл бұрын
❤️
Rust Linz, August 2021 - Rainer Stropek - Rust iterators
1:15:44
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 36 МЛН
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН
СОБАКА ВЕРНУЛА ТАБАЛАПКИ😱#shorts
00:25
INNA SERG
Рет қаралды 3,6 МЛН
Rust Generics and Traits: Define Common Struct Behaviors 🦀
32:23
Trevor Sullivan
Рет қаралды 7 М.
"Type-Driven API Design in Rust" by Will Crichton
40:57
Strange Loop Conference
Рет қаралды 124 М.
Rust Before Main - Ryan Levick - Rust Linz, July 2022
31:34
Rust: Generics, Traits, Lifetimes
35:34
The Dev Method
Рет қаралды 49 М.
Rainer Stropek - Memory Management in Rust
59:48
Rust
Рет қаралды 12 М.
Traits and You: A Deep Dive - Nell Shamrell-Harrington
22:09
Rust Belt Rust Conference
Рет қаралды 39 М.
Rust Structs, Traits and Impl
24:53
Doug Milford
Рет қаралды 34 М.
Implementing Rust Traits
12:19
Andrew Burgess
Рет қаралды 14 М.
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 36 МЛН