How do we organize code in Rust? Where do we break it apart into modules or crates, and why?

Notes Structuring code in a language like Rust can seem a bit more ambiguous than doing the same in a language with classes to attach all our functionality to, but in practice, the concerns are much the same: modules are namespaces, and we group by responsibility. In today's episode, I talk through that philosophy (and give some comparisons to other languages), and then look at what it looks like in practice!

Links * Learning Rust Modules, by Jeff Walker, has a nice comparison of C# namespaces and Rust modules. * The commit on Lightning inspired by this episode.

Sponsors * Aleksey Pirogov * Andreas Fischer * Andrew Thompson * Austin LeSure * Ben Whitley * Charlie Egan * Chris Jones * Chris Palmer * Christopher Giffard * Dan Abrams * Daniel Collin * Derek Morr * Eugene Bulkin * Jakub "Limeth" Hlusička * Jordan Henderson * Jupp Müller * Justin Ossevoort * Karl Hobley * Keith Gray * Lachlan Collins * Luca Schmid * Matt Rudder * Matthew Piziak * Max Jacobson * Micael Bergeron * Ovidiu Curcan * Pascal Hertleif * Patrick O'Doherty * Peter Tillemans * Philipp Keller * Ralph Giles ("rillian") * Raph Levien * reddraggone9 * Steven Murawski * Stuart Hinson * Tyler Harper * Vesa Kaihlavirta * Vlad Bezden * Warren Harper * William Roe * Zaki

(Thanks to the couple people donating who opted out of the reward tier, as well. You know who you are!)

Become a sponsor * Patreon * Venmo * Dwolla * Cash.me * Flattr * PayPal.me

Contact * New Rustacean: + Twitter: @newrustacean + Email: hello@newrustacean.com * Chris Krycho + GitHub: chriskrycho + Twitter: @chriskrycho