Skip to main content

cargo_smith/templates/modular/
mod.rs

1use crate::templates::Template;
2use anyhow::Result;
3use async_trait::async_trait;
4
5// Import the logic from the sub-files
6mod generate;
7mod feature;
8
9pub struct ModularTemplate;
10
11#[async_trait]
12impl Template for ModularTemplate {
13    fn name(&self) -> &str { "Modular" }
14
15    fn description(&self) -> &str {
16        "Modular Rust/Actix Web structure organized by features"
17    }
18
19    // Delegate to the specialized file
20    async fn generate(&self, project_name: &str) -> Result<()> {
21        generate::run(project_name).await
22    }
23
24    // Delegate to the specialized file
25    async fn add_feature(&self, feature_name: &str) -> Result<()> {
26        feature::run(feature_name).await
27    }
28}