pub struct Templates { /* private fields */ }Expand description
Template-based TypeScript code emitter and template handler Templates are loaded via minijinja_embed from build.rs
Implementations§
Source§impl Templates
impl Templates
Sourcepub fn new(generator: GeneratorType) -> Self
pub fn new(generator: GeneratorType) -> Self
Create a new template handler with initialized templates for a specific generator Each instance has its own Environment (not shared) Templates are loaded via minijinja_embed from build.rs
pub fn render_template( &self, template_name: TemplateName, output_filename: &str, context: Value, ) -> Result<FileInfo, GeneratorError>
Sourcepub fn render_template_string(
&self,
template_name: TemplateName,
context: Value,
) -> Result<String, GeneratorError>
pub fn render_template_string( &self, template_name: TemplateName, context: Value, ) -> Result<String, GeneratorError>
Render a template and return the content as a string
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Templates
impl !RefUnwindSafe for Templates
impl Send for Templates
impl Sync for Templates
impl Unpin for Templates
impl UnsafeUnpin for Templates
impl !UnwindSafe for Templates
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