How can I find good sample code?

I'm new to rust (with a C++ background), and would like to have a closer look and try to understand some well written crates. What crates are considered to have a nice and up to date design? I'm very interested in how the API is provided. Currently I am looking at https://crates.io/crates?sort=downloads and randomly choose libs that sound interesting.

1 Like

Well, I'm no expert, but if the code in the std library isn't an example of good code, I'd say something is seriously wrong. While it is a bit special and may have extra reasons for breaking good style, they should also be properly commented.

Code in the std are mostly compiler internal functions, I believe he is looking for codes that uses the std library very well. I can suggest servo

I've recently had a pleasure of reading https://github.com/alexcrichton/futures-rs and highly recommend it! It's short, but beautiful.

1 Like