<commit_before>//! Modules are the recommended way to implement larger or more
//! pluggable applications.
pub struct Module;<commit_msg>Added basic module<commit_after>//! Modules are the recommended way to implement larger or more
//! pluggable applications.

use app::Pencil;


/// Represents a module.
pub struct Module {
    /// The name of the module.
    pub name: String,
    /// The path where your module locates.
    pub root_path: String,
    /// The url prefix.
    pub url_prefix: String,
    /// The folder with static files that should be served at `static_url_path`.
    /// Defaults to the `"static"` folder in the root path of the module.
    pub static_folder: Option<String>,
    /// The url path for the static files on the web.
    pub static_url_path: Option<String>,
    /// The folder that contains the templates that should be used for the module.
    /// Defaults to `''templates''` folder in the root path of the module.
    pub template_folder: Option<String>,
    deferred_functions: Vec<Box<Fn(&mut Pencil)>>,
}

impl Module {
    pub fn new(name: &str, root_path: &str, url_prefix: &str) -> Module {
        Module {
            name: name.to_string(),
            root_path: root_path.to_string(),
            url_prefix: url_prefix.to_string(),
            static_folder: None,
            static_url_path: None,
            template_folder: None,
            deferred_functions: Vec::new(),
        }
    }

    pub fn record<F: Fn(&mut Pencil) + 'static>(&mut self, f: F) {
        self.deferred_functions.push(Box::new(f));
    }
}
{'fraction_non_alphanumeric': 0.10834926704907584, 'fraction_numerical': 0.0, 'mean_word_length': 2.6511627906976742, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6148520', 'n_tokens_mistral': 456, 'n_tokens_neox': 448, 'n_words': 166}