pub trait Template<F>: Sizedwhere
F: TemplateFiles + Default,{
// Required methods
fn create_all(self, path: &Path) -> Result<(), Error>;
fn parameters(&self) -> &TemplateParameters;
fn set_values(&mut self, values: TemplateValues);
fn parameter_storage(&self) -> &Path;
fn template_name(&self) -> &'static str;
fn get_values(&self) -> &TemplateValues;
fn get_values_mut(&mut self) -> &mut TemplateValues;
// Provided methods
fn load_existing_params(&mut self, path: &Path) -> Option<()> { ... }
fn get_missing_mandatory(&self) -> Vec<&str> { ... }
}Expand description
Trait for creating a template for a file structure.
Required Methods§
Sourcefn create_all(self, path: &Path) -> Result<(), Error>
fn create_all(self, path: &Path) -> Result<(), Error>
Creates all files in the template.
Path is the base path for the template to be created in.
Sourcefn parameters(&self) -> &TemplateParameters
fn parameters(&self) -> &TemplateParameters
Returns all parameters used by the template.
Sourcefn set_values(&mut self, values: TemplateValues)
fn set_values(&mut self, values: TemplateValues)
Sets values for provided parameters.
Sourcefn parameter_storage(&self) -> &Path
fn parameter_storage(&self) -> &Path
Relative path for parameter values storage.
Sourcefn template_name(&self) -> &'static str
fn template_name(&self) -> &'static str
Sourcefn get_values(&self) -> &TemplateValues
fn get_values(&self) -> &TemplateValues
Get all template values.
Sourcefn get_values_mut(&mut self) -> &mut TemplateValues
fn get_values_mut(&mut self) -> &mut TemplateValues
Get all template values as a mutable reference.
Provided Methods§
Sourcefn load_existing_params(&mut self, path: &Path) -> Option<()>
fn load_existing_params(&mut self, path: &Path) -> Option<()>
Loads provided parameters from previous run.
Sourcefn get_missing_mandatory(&self) -> Vec<&str>
fn get_missing_mandatory(&self) -> Vec<&str>
Fetches mandatory parameters that are not set yet.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.