TemplateEngine

Struct TemplateEngine 

Source
pub struct TemplateEngine {
    pub loader: TemplateLoader,
    pub context: TemplateContext,
    pub validator: TemplateValidator,
    pub function_registry: FunctionRegistry,
    pub toml_loader: TomlLoader,
    pub toml_writer: TomlWriter,
    pub toml_merger: TomlMerger,
    pub cache: CachedRenderer,
    pub output_format: OutputFormat,
    pub debug_enabled: bool,
}
Expand description

Complete template engine with all configured components

Provides access to all template engine components for advanced usage scenarios

Fields§

§loader: TemplateLoader

Template loader for template discovery and loading

§context: TemplateContext

Template context for variable resolution

§validator: TemplateValidator

Template validator for output validation

§function_registry: FunctionRegistry

Custom function registry

§toml_loader: TomlLoader

TOML file loader

§toml_writer: TomlWriter

TOML file writer

§toml_merger: TomlMerger

TOML merger for combining files

§cache: CachedRenderer

Cached renderer for performance

§output_format: OutputFormat

Default output format

§debug_enabled: bool

Debug mode enabled

Implementations§

Source§

impl TemplateEngine

Source

pub fn render(&mut self, name: &str) -> Result<String>

Render template by name

§Arguments
  • name - Template name
Source

pub fn render_with_context( &mut self, name: &str, context: TemplateContext, ) -> Result<String>

Render template with custom context

§Arguments
  • name - Template name
  • context - Custom context for rendering
Source

pub fn render_to_format( &mut self, name: &str, format: OutputFormat, ) -> Result<String>

Render template to specific format

§Arguments
  • name - Template name
  • format - Output format
Source

pub fn validate_template(&self, name: &str) -> Result<()>

Validate template output

§Arguments
  • name - Template name
Source

pub fn load_toml_file<P: AsRef<Path>>(&self, path: P) -> Result<TomlFile>

Load TOML file

§Arguments
  • path - Path to TOML file
Source

pub fn write_toml_file<P: AsRef<Path>>( &self, path: P, content: &str, ) -> Result<()>

Write TOML file

§Arguments
  • path - Target file path
  • content - TOML content to write
Source

pub fn cache_stats(&self) -> CacheStats

Get cache statistics

Source

pub fn clear_cache(&self)

Clear cache

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V