You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: generate.rs
    path of file: ./repos/loco/loco-cli/src
    
    the code of the file until where you have to start completion: use std::{
    collections::BTreeMap,
    env, fs,
    io::{Read, Write},
    path::PathBuf,
};

use ignore::WalkBuilder;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use regex::Regex;
use serde::{Deserialize, Serialize};

// Name of generator template that should be existing in each sta
    
    fn can_generate() {
        let yaml_content = r#"
        files:
        - path: Cargo.toml
          content: | 
            name = "loco_starter"
        - path: test.yaml
          content: | 
            secret = MY_SECRET
        - path: any.yaml
          content: | 
            database:
                uri: {{ get_env(name="DATABASE_URL", default="postgres://loco:loco@localhost:5432/loco_app") }}
        "#;
        let tree_res = tree_fs::from_yaml_str(yaml_content).unwrap();

        let template = Template {
            description: "test template".to_string(),
            rules: Some(vec![
                TemplateRule {
                    pattern: Regex::new("loco.*").unwrap(),
                    kind: TemplateRuleKind::LibName,
                    file_patterns: None,
                    skip_in_ci: None,
                },
                TemplateRule {
                    pattern: Regex::new("MY_SECRET").unwrap(),
                    kind: TemplateRuleKind::JwtToken,
                    file_patterns: None,
                    skip_in_ci: None,
                },
                TemplateRule {
                    pattern: Regex::new("postgres://loco:loco@localhost:5432/loco_app").unwrap(),
                    kind: TemplateRuleKind::Any(
                        "postgres://loco:loco@localhost:5432/{{LibName}}_test".to_string(),
                    ),
                    file_patterns: None,
                    skip_in_ci: None,
                },
            ]),
        };

        let args = ArgsPlaceholder {
            lib_name: "lib_name_changed".to_string(),
        };
        template.generate(&tree_res, &args);

        assert_debug_snapshot!(fs::read_to_string(tree_res.join("Cargo.toml")));

        with_settings!({
            filters => vec![
            (r"([A-Za-z0-9]){20}", "RAND_SECRET"),
            ]
        }, {
            assert_debug_snapshot!(fs::read_to_string(tree_res.join("test.yaml")));
            assert_debug_snapshot!(fs::read_to_string(tree_res.join("any.yaml")));

        });
    }