Builder

Struct Builder 

Source
pub struct Builder<'p> { /* private fields */ }

Implementations§

Source§

impl<'p> Builder<'p>

Source

pub fn new( sources_dir: Option<PathBuf>, templates_dir: Option<PathBuf>, generated_dir: Option<PathBuf>, variables_file: Option<PathBuf>, options: BuilderOptions, ) -> Result<Self, BuilderError>

Source

pub fn add_local_source( &mut self, name: impl ToString, content: impl ToString, ) -> Result<&mut Self, EvaluatorBuilderError>

Adds a local source.

Source

pub fn add_local_template( &mut self, name: impl ToString, content: impl ToString, ) -> Result<&mut Self, EvaluatorBuilderError>

Source

pub fn add_local_sources( &mut self, items: &[(impl ToString, impl ToString)], ) -> Result<&mut Self, Vec<(String, EvaluatorBuilderError)>>

Adds multiple local sources.

Source

pub fn add_local_templates( &mut self, items: &[(impl ToString, impl ToString)], ) -> Result<&mut Self, Vec<(String, EvaluatorBuilderError)>>

Adds multiple local templates.

Source

pub fn add_variable(&mut self, name: impl ToString, value: Value) -> &mut Self

Adds a variable.

Source

pub fn add_variables(&mut self, variables: &[(String, Value)]) -> &mut Self

Adds multiple variables.

Source

pub fn add_function( &mut self, name: impl ToString, function: ValueFunction, ) -> &mut Self

Adds a function.

Source

pub fn add_functions( &mut self, functions: Vec<(String, ValueFunction)>, ) -> &mut Self

Adds functions.

Source

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.

Source

pub fn write_source(&mut self, name: &str)

Evaluates a source and writes it to its target.

Source

pub fn get_source(&self, name: &str) -> Option<&Partial<'_>>

Finds and returns a source by its name.

Source

pub fn rebuild(&mut self)

Rescans and rebuilds the entire project.

Source

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> 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> 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, 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.