pub struct Builder<'p> { /* private fields */ }Implementations§
Source§impl<'p> Builder<'p>
impl<'p> Builder<'p>
pub fn new( sources_dir: Option<PathBuf>, templates_dir: Option<PathBuf>, generated_dir: Option<PathBuf>, variables_file: Option<PathBuf>, options: BuilderOptions, ) -> Result<Self, BuilderError>
Sourcepub fn add_local_source(
&mut self,
name: impl ToString,
content: impl ToString,
) -> Result<&mut Self, EvaluatorBuilderError>
pub fn add_local_source( &mut self, name: impl ToString, content: impl ToString, ) -> Result<&mut Self, EvaluatorBuilderError>
Adds a local source.
pub fn add_local_template( &mut self, name: impl ToString, content: impl ToString, ) -> Result<&mut Self, EvaluatorBuilderError>
Sourcepub fn add_local_sources(
&mut self,
items: &[(impl ToString, impl ToString)],
) -> Result<&mut Self, Vec<(String, EvaluatorBuilderError)>>
pub fn add_local_sources( &mut self, items: &[(impl ToString, impl ToString)], ) -> Result<&mut Self, Vec<(String, EvaluatorBuilderError)>>
Adds multiple local sources.
Sourcepub fn add_local_templates(
&mut self,
items: &[(impl ToString, impl ToString)],
) -> Result<&mut Self, Vec<(String, EvaluatorBuilderError)>>
pub fn add_local_templates( &mut self, items: &[(impl ToString, impl ToString)], ) -> Result<&mut Self, Vec<(String, EvaluatorBuilderError)>>
Adds multiple local templates.
Sourcepub fn add_variable(&mut self, name: impl ToString, value: Value) -> &mut Self
pub fn add_variable(&mut self, name: impl ToString, value: Value) -> &mut Self
Adds a variable.
Sourcepub fn add_variables(&mut self, variables: &[(String, Value)]) -> &mut Self
pub fn add_variables(&mut self, variables: &[(String, Value)]) -> &mut Self
Adds multiple variables.
Sourcepub fn add_function(
&mut self,
name: impl ToString,
function: ValueFunction,
) -> &mut Self
pub fn add_function( &mut self, name: impl ToString, function: ValueFunction, ) -> &mut Self
Adds a function.
Sourcepub fn add_functions(
&mut self,
functions: Vec<(String, ValueFunction)>,
) -> &mut Self
pub fn add_functions( &mut self, functions: Vec<(String, ValueFunction)>, ) -> &mut Self
Adds functions.
Sourcepub fn update_variables<'a>(
&mut self,
variables: Vec<(String, impl Borrow<Expression<'a>>)>,
)
pub fn update_variables<'a>( &mut self, variables: Vec<(String, impl Borrow<Expression<'a>>)>, )
Updates the global variables, and rebuilds all the sources that rely on them.
Sourcepub fn write_source(&mut self, name: &str)
pub fn write_source(&mut self, name: &str)
Evaluates a source and writes it to its target.
Sourcepub fn get_source(&self, name: &str) -> Option<&Partial<'_>>
pub fn get_source(&self, name: &str) -> Option<&Partial<'_>>
Finds and returns a source by its name.
pub fn watch(&mut self) -> Result<()>
Auto Trait Implementations§
impl<'p> Freeze for Builder<'p>
impl<'p> !RefUnwindSafe for Builder<'p>
impl<'p> !Send for Builder<'p>
impl<'p> !Sync for Builder<'p>
impl<'p> Unpin for Builder<'p>
impl<'p> !UnwindSafe for Builder<'p>
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