This repository was archived by the owner on Aug 14, 2025. It is now read-only.
Open
Conversation
mcass19
approved these changes
Jan 24, 2023
There was a problem hiding this comment.
I'm from the Option A school, but always prefer this against nothing. Great work ❤️
Could be beneficial to install something like https://github.com/regexident/cargo-modules?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Defines a uniform way to import modules, switches those messy
use super::super::super::super...into always going to the root:Delegates the submodule declaration to each module, we used to have all modules declared in
main.rsI took a very opinionated decision here, so let me know what you think, we could declare the modules and submodules for our current codebase as follows:
Option A
Option B
- system - render_sytem // folder - mod.rs // contains main render_system module, and sub-module declarations (`pub mod camera`) - camera.rs - physics_system // folder - mod.rs - physics.rs ... etc.I went for option B, I believe having everything in the same folder makes it clearer and avoids a bunch of scrolling and clicking when navigating graphically through the codebase. It also makes module declaration feel more explicit even if the file also contains code. i.e.: you know you'll always find the mod declaration in the
mod.rsfileI'd like to also set up a convention when organizing the imports at the top of the file, for the time being, I used:
Unrelated, but also finally ran
cargo fmtand removed/docsfrom the.gitignorefile (so you'll see diagrams added)