Can you recommend idiomatic code for my reading list

Hey Everyone,

I’ve got 20+ years of experience with Linux & C++, but I’m new here (both to the forums and to the language). I want to get off to the right foot. I’m going to be working my way through the book (2018 edition). But it’s also important to me to start reading lots of high quality, idiomatic, real world Rust code.

To that end, I wanted to post an open-ended request for recommended reading. What code can you recommend? Which code exemplifies the methods and styles you’d most like to see in a new colleague or collaborator?

I’m particularly interested in algorithms, RDBMs/SQL, cross platform guis, and 2d vector graphics. But absolutely any recommendations are very welcome.

Thanks much!
-james s.

This is the best advice I've seen in this forum.


BurntSushi's repositories are generally very well-written examples of rust code, and cover at least one base - algorithms. In particular, regex, and its dependencies, like regex-syntax and aho-corasick are good examples of very fast, yet well written algorithm crates. ripgrep is a high quality (and also very fast) command line tool which uses crates like these.

On the RDBMs side, this isn't SQL, but I've found sled to be quite a nice repository to use, and also to read. It's a full-Rust embeddable nosql database, with, as I understand it, novel data structures, and an implementation that could eventually compete evenly with the likes of RocksDB.

Cross platform GUIs, there are lots of incomplete crates, but I don't think I'd rate any of them as particularly high quality. Or at least, I've used two or three of them, and been slightly horrified at their internals. They're not that bad, just definitely new, and many refactors away from a clean codebase. I think, since this is a huge space and there's a lot to implement before projects get "done", features might be prioritized over cleanliness?

With that said, I've heard good things about druid and orbtk. And since I've used neither of them, I can't claim I know they're bad :stuck_out_tongue:.

Finally, on vector graphics, I think lyon is the best/furthest crate out there. I don't know enough about it to rate its codebase's cleanliness, but I know there's been a ton of work put into it and the API is quite nice.


This isn't quite the topic you asked for, but the Tokio project has published a project called mini-redis, which is written with the explicit purpose of being an example of what idiomatic async Rust looks like.


Thank you for all the great info!
I'm off to a good start and having fun checking out all the projects you mentioned. I'm making headway in the book, and I've connected with the rust #beginners discord channel too.

so excited!

Wow alice, I wish I had spotted mini-redis a week ago. It would have saved me about three days learning how to introduce threads into my current little project with tokio!

Now that my application is up and running, indeed pressed into production hot off the presses, I started to wonder if it was a half decent example of a Rust program?

I mean, what is wrong with me? : I had almost no problems with lifetimes and the borrow checker, there is not even one lifetime tick mark in my code. I have not written any traits. I have only the most basic use of iterators and the 'functional' style. I have a few 'clone's around that could likely be done away with but I suspect the have negligible performance impact.

A quick scan of the mini-redis sorce shows:

mini-redis only include's one lifetime tick mark.

mini-redis only defines a handful of traits, mostly to do with custom errors.

mini-redis only has four uses of 'iter'.

Great, now I feel better about my effort.

Thanks for the link, I'm sure there are a few tricks in there to pick up.

Mini-redis was created partly to be the thing you implement in our upcoming Tokio tutorial. A redis server was chosen for this purpose because it lets us touch on all the topics we wanted to cover in the tutorial.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.