Prompt
Maintain code organization by keeping files focused on a single responsibility and splitting large files into smaller, well-organized modules. This improves code navigation, readability, and maintainability.
Key guidelines:
- Move code to dedicated files when it represents a distinct functionality
- Split large files (>500 lines) into logical modules
- Place related functionality in the same module
- Use clear, descriptive file names that reflect the content
Example of good organization:
// Instead of putting everything in mod.rs:
// src/binary/mod.rs
mod local_proxy; // Move to separate file
pub use local_proxy::*;
// src/binary/local_proxy.rs
pub struct LocalProxy {
// Implementation details
}
// Instead of one large compute.rs:
// src/compute/mod.rs
mod core; // Core compute functionality
mod prewarm; // Prewarm-specific implementations
mod helpers; // Helper functions
pub use core::ComputeNode;
This approach:
- Makes code easier to navigate and maintain
- Reduces cognitive load when working with the codebase
- Facilitates code review and testing
- Improves module cohesion