[Verse 1] When your Rust code grows too big to handle Split it up, don't let it ramble Modules help you organize your way Keep related functions where they stay Use the mod keyword, give it a name Separate concerns, that's the game [Chorus] Modules make it modular, Cargo makes it portable Build and test and run with ease Packages and dependencies Pub means public, private's default rule Crates dot io is your coding tool [Verse 2] In your source create a dot r s file Or make a folder, either style Public functions need the pub keyword there Without it, they can't be shared anywhere Use paths like parent, self, and crate Navigate your module state [Chorus] Modules make it modular, Cargo makes it portable Build and test and run with ease Packages and dependencies Pub means public, private's default rule Crates dot io is your coding tool [Bridge] Cargo dot toml holds your project info Name and version, watch it grow Cargo build will compile your code Cargo run starts up your load Add dependencies with just one line External crates work just fine [Verse 3] Workspace feature groups projects together Share dependencies, code gets better Library crates and binary crates too Choose the right one for what you do From local path or git repository Import the code to tell your story [Chorus] Modules make it modular, Cargo makes it portable Build and test and run with ease Packages and dependencies Pub means public, private's default rule Crates dot io is your coding tool [Outro] Structure your code, make it clean Best organization you've ever seen Modules and Cargo, hand in hand Building Rust projects across the land
← Dynamic Magic in Your Coding Space | Memory Jazz with Flair →