Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Rust Programming Tutorial #34 – Multiple Source Files (Modules)

28.4K views on YouTube

dcode 42 tutorials here

Today we look at how to organise your code better within your Rust projects by creating separate source files (or modules). By doing so, it makes your code much more readable, easier to understand and easier to maintain.

We take a look at the ‘mod’ keyword as well as creating a module, importing it and using it. With this, we also look at public visibility for functions and the assumed private visibility.

Take a look here for more information:
https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html

If this video helped you out and you’d like to see more, make sure to leave a like and subscribe to dcode!