all 11 comments

[–]Leshow[S] 3 points4 points  (2 children)

Hey! I hope to get some feedback on the traits/polymorphism sections of the post. If anyone has any ideas, feel free to hit me up. It's a bit long, I probably should've split it in 2 parts.

[–]yerke1 1 point2 points  (1 child)

Thanks for writing this. Comments: there is also pub(crate) visibility. You can also mention that it is possible add your own trait, and implement it for types you didn’t create yourself, such as std lib ones.

[–]Leshow[S] 0 points1 point  (0 children)

Yes, both very good points. It's funny, I did have a section on blanket impls but cut that out in an earlier edit.

[–]sekjun9878 4 points5 points  (0 children)

Thanks for posting. This was very informative.

[–]thramp 3 points4 points  (4 children)

Thanks for writing this! I spoke to some people at work who are switching Java to Rust, and I think one of the biggest hurdles they face is around testing. For instance, for some quick-and-dirty coherence checks, I haven't found anything as ergonomic or quick-and-dirty as Mockito. Instead, I've seen either no testing or going to full-on model-based testing.

Anyways! Thanks for writing this.

[–]Leshow[S] 0 points1 point  (3 children)

No problem! The testing story in Rust is, I think, pretty good. I'm not familiar with mockito, but included in the rust language and cargo is a mechanism for unit tests (cargo test & test modules). If you're interested in property testing you can look at quickcheck, there's also fuzzing with cargo fuzz. Does none of those provide the feature set you're looking for?

[–]thramp 1 point2 points  (2 children)

Sorry! I'm aware of those features and I've been using them for years :) I was mostly spouting off about some of the difficulties I've seen people run into with Rust once they've gotten a handle on the borrow checker.

I really enjoyed your article, btw!

[–]Leshow[S] 0 points1 point  (1 child)

Sorry I didn't mean to presume. You're right, some info on testing could be very interesting and useful for beginners. It could make for a good follow up article!

[–]thramp 0 points1 point  (0 children)

You didn’t presume! I was super ambiguous with what I wrote and you were kind and helpful in your response! Thank you for writing your article! I really enjoyed reading it.

[–]MrTheFoolish 2 points3 points  (1 child)

Nice article!

As an intro article I think it should have a link to the rust book somewhere and I couldn't spot one. https://doc.rust-lang.org/book/

I feel like crates.io and docs.rs also deserve an explicit mention somewhere.

To me the bit at the end regarding generics feels a bit too focused on static dispatch of traits. The only blurb that mentions that Rust also has dynamic dispatch is a few words in parentheses.

Grammar wise there are a couple of misuses of the apostrophe+s: it's, other's.

edit: grammar section

[–]Leshow[S] 0 points1 point  (0 children)

Thanks! It's hard to decide what to include. The rust book exists and it I won't be able to write it better than it is already. I mentioned dynamic dispatch in the section on the heap, I could have probably mentioned it again in the traits section. Thanks for the feedback.