Rust मॉड्यूल को कई फ़ाइलों में सही तरीके से कैसे विभाजित करें?
सभी को नमस्ते! मैंने Rust सीखना शुरू किया है और मॉड्यूल में कोड को व्यवस्थित करने की समस्या का सामना कर रहा हूँ। मेरे पास एक `main.rs` फ़ाइल है, जिसमें मैंने `shapes` मॉड्यूल इस प्रकार घोषित किया है:\n\n```rust\nmod shapes;\n\nfn main() {\n let rect = shapes::Rectangle::new(3.0, 4.0);\n println!("क्षेत्रफल: {}", rect.area());\n}\n```\n\n`shapes.rs` में मैंने structs और functions परिभाषित किए:\n\n```rust\npub struct Rectangle {\n width: f64,\n height: f64,\n}\n\nimpl Rectangle {\n pub fn new(w: f64, h: f64) -> Rectangle {\n Rectangle { width: w, height: h }\n }\n \n pub fn area(&self) -> f64 {\n self.width * self.height\n }\n}\n```\n\nसब कुछ काम कर रहा है, लेकिन अब मैं और आकृतियाँ जोड़ना चाहता हूँ: `Circle`, `Triangle`। अगर मैं सब कुछ एक ही `shapes.rs` में डालूँ, तो फ़ाइल बहुत बड़ी हो जाएगी। मैंने `shapes/` फ़ोल्डर बनाने की कोशिश की