From 5f6af44aeea53ebed60e381791ef37c688e68333 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Tue, 21 Jan 2025 17:45:35 +0100 Subject: [PATCH] Rename modules to follow new convention Rename module files from `foobar/mod.rs` to `foobar/_foobar.rs`. The full name is for readability when multiple module files are open in a text editor. The leading underscore is so these names appear first in file hierarchies. --- masonry/ARCHITECTURE.md | 7 ++++--- masonry/src/doc/{mod.rs => _doc.rs} | 0 masonry/src/lib.rs | 5 +++++ masonry/src/passes/{mod.rs => _passes.rs} | 0 masonry/src/testing/{mod.rs => _testing.rs} | 0 masonry/src/text/{mod.rs => _text.rs} | 0 masonry/src/widget/{mod.rs => _widget.rs} | 1 + masonry/src/widget/tests/{mod.rs => _tests.rs} | 0 8 files changed, 10 insertions(+), 3 deletions(-) rename masonry/src/doc/{mod.rs => _doc.rs} (100%) rename masonry/src/passes/{mod.rs => _passes.rs} (100%) rename masonry/src/testing/{mod.rs => _testing.rs} (100%) rename masonry/src/text/{mod.rs => _text.rs} (100%) rename masonry/src/widget/{mod.rs => _widget.rs} (99%) rename masonry/src/widget/tests/{mod.rs => _tests.rs} (100%) diff --git a/masonry/ARCHITECTURE.md b/masonry/ARCHITECTURE.md index fec6fc3c2..7ae1a77d5 100644 --- a/masonry/ARCHITECTURE.md +++ b/masonry/ARCHITECTURE.md @@ -66,13 +66,14 @@ Virtually every module should be private. The only public modules should be inli Most items should be exported from the root module, with no other public-facing export. This makes documentation more readable; readers don't need to click on multiple modules to find the item they're looking for. -There should be only three public modules: +There should be only two public modules: - `widgets` -- `commands` - `test_widgets` -Module files should not be `foobar/mod.rs`. Instead, they should be `_foobar.rs` (thus in the parent folder); the full name is for readability, the leading underscore is so these names appear first in file hierarchies. +Module files should not be `foobar/mod.rs`. Instead, they should be `foobar/_foobar.rs`. +The full name is for readability when multiple module files are open in a text editor. +The leading underscore is so these names appear first in file hierarchies. ### Imports diff --git a/masonry/src/doc/mod.rs b/masonry/src/doc/_doc.rs similarity index 100% rename from masonry/src/doc/mod.rs rename to masonry/src/doc/_doc.rs diff --git a/masonry/src/lib.rs b/masonry/src/lib.rs index 4769e8901..07d71c6a0 100644 --- a/masonry/src/lib.rs +++ b/masonry/src/lib.rs @@ -148,6 +148,7 @@ mod util; #[cfg(doc)] +#[path = "doc/_doc.rs"] pub mod doc; mod action; @@ -156,14 +157,18 @@ mod box_constraints; mod contexts; mod event; mod paint_scene_helpers; +#[path = "passes/_passes.rs"] mod passes; mod render_root; mod tracing_backend; pub mod event_loop_runner; +#[path = "testing/_testing.rs"] pub mod testing; +#[path = "text/_text.rs"] pub mod text; pub mod theme; +#[path = "widget/_widget.rs"] pub mod widget; pub use cursor_icon; diff --git a/masonry/src/passes/mod.rs b/masonry/src/passes/_passes.rs similarity index 100% rename from masonry/src/passes/mod.rs rename to masonry/src/passes/_passes.rs diff --git a/masonry/src/testing/mod.rs b/masonry/src/testing/_testing.rs similarity index 100% rename from masonry/src/testing/mod.rs rename to masonry/src/testing/_testing.rs diff --git a/masonry/src/text/mod.rs b/masonry/src/text/_text.rs similarity index 100% rename from masonry/src/text/mod.rs rename to masonry/src/text/_text.rs diff --git a/masonry/src/widget/mod.rs b/masonry/src/widget/_widget.rs similarity index 99% rename from masonry/src/widget/mod.rs rename to masonry/src/widget/_widget.rs index 378749fcc..45f759316 100644 --- a/masonry/src/widget/mod.rs +++ b/masonry/src/widget/_widget.rs @@ -14,6 +14,7 @@ mod widget_ref; mod widget_state; #[cfg(test)] +#[path = "tests/_tests.rs"] mod tests; mod align; diff --git a/masonry/src/widget/tests/mod.rs b/masonry/src/widget/tests/_tests.rs similarity index 100% rename from masonry/src/widget/tests/mod.rs rename to masonry/src/widget/tests/_tests.rs