There is definitely a discoverability issue with traits. If you're working on a trait heavy API like Axum it can be really perplexing why your code won't build - and the IDE doesn't offer any suggestions. At least, mine doesn't. Maybe RustRover will do a better job
@avatar098 Жыл бұрын
I started thinking of modules as their own type. Traits are part of the module as much as any other struct / function that is defined.
@wojciechrazik Жыл бұрын
Shouldn't the trait be in the same scope as the macro? Maybe the good practice should be to always expose the trait? Please record longer video with explanations!
@JohnSmith-ni4cs Жыл бұрын
Traits are indeed weird. Perhaps do a video on how to organize code using traits for people that are used to thinking in the OOP way?
@jahongirrahmonov7323 Жыл бұрын
You left out one "lbalbalba" at 2:12 lmao
@markmcdonnell11 ай бұрын
This issue of a trait having to be imported is so annoying in Rust
@agustindiaz336110 ай бұрын
good video! thanks for it some constructive feedback: I think this had a lot of intro and little explanation + conclusion. I think it could be improved by going a bit faster in the beginning and then explaining deeper
@sus7801 Жыл бұрын
why is this?
@JohnPywtorak Жыл бұрын
I was wondering the same, but thinking is it related to being buried in a macro and that’s why it needs to be in scope.
@dmitriidemenev5258 Жыл бұрын
It is actually a useful behavior because then it's easier to understand where methods come from. It's better for the reader.
@sus7801 Жыл бұрын
@@dmitriidemenev5258 I think it's kinda cringe, I'd hate to have to have a class which implements an interface, use that class in another file...then have to import that interface anyway, feels a bit leaky / breaking encapsulation
@dmitriidemenev5258 Жыл бұрын
@@sus7801 The point is that you can implement (local) traits for external crates. And traits can use the same method names.
@sus7801 Жыл бұрын
@@dmitriidemenev5258 you can still get name collisions though, although I do guess I sort of understand, blanket implementations would break a lot of code, not an ideal solution though
@greggoog7559 Жыл бұрын
Programmers are really weird. Does anyone need all that odd jargon?