pub struct Template {
pub description: String,
pub rules: Option<Vec<TemplateRule>>,
}Expand description
Represents the configuration of a template generator.
Fields§
§description: StringDescription of the template.
rules: Option<Vec<TemplateRule>>List of rules for placeholder replacement in the generator.
Implementations§
source§impl Template
impl Template
sourcepub fn generate(&self, from: &PathBuf, args: &ArgsPlaceholder)
pub fn generate(&self, from: &PathBuf, args: &ArgsPlaceholder)
Generates files based on the given template by recursively applying template rules to files within the specified path.
Description
This method utilizes a parallel file walker to traverse the directory
structure starting from the specified root path (from). For each
file encountered, it checks whether the template rules should be
applied based on file patterns. If the rules are applicable and an error
occurs during the application, the error is logged, and the walker
is instructed to quit processing further files in the current
subtree.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Template
impl<'de> Deserialize<'de> for Template
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnwindSafe for Template
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more