Well written code examples

You should probably look at the core crates of the ecosystem. For example:

  • serde, because the core idea of separating data structures and serialization formats generically is very neat;
  • clap, because its #[derive(Parser)] is basically the right approach to strongly-typed argument parsing;
  • quote, because it demonstrates how to write usable, robust declarative macros for the real world.

I'd like to think that the code I write is also idiomatic; if I may nominate some of my own crates for studying, those would be:

  • parsel, which shows how to use types, composition, and derive macros, for avoiding boilerplate;
  • ring_api, which demonstrates the way I wrap a request-response protocol in a completely generic and extensible way.
5 Likes