pub struct Template<'a> {
pub functions: HashMap<String, Box<Node>>,
pub spreadsheet: RefCell<Spreadsheet>,
pub variables: HashMap<String, Box<Node>>,
/* private fields */
}Fields§
§functions: HashMap<String, Box<Node>>§spreadsheet: RefCell<Spreadsheet>§variables: HashMap<String, Box<Node>>Implementations§
source§impl Template<'_>
impl Template<'_>
pub fn write_object_file(&self, source_code: &SourceCode) -> Result<PathBuf>
source§impl<'a> Template<'a>
impl<'a> Template<'a>
pub fn compile(runtime: &'a Runtime) -> Result<Self>
sourcepub fn new(
spreadsheet: Spreadsheet,
code_section: Option<CodeSection>,
runtime: &'a Runtime
) -> Self
pub fn new( spreadsheet: Spreadsheet, code_section: Option<CodeSection>, runtime: &'a Runtime ) -> Self
Given a parsed code section and spreadsheet section, this function will assemble all of the available functions and variables. There are some nuances here because there are a lot of sources of functions and variables and they’re allowed to override each other.
Function Precedence
Functions are just comprised of what is builtin and what the user puts in the code section. The code section functions can override builtins so the precedence is (with the lowest number being the one that is used):
- Functions in the code section
- Builtin functions
Variable Precedence
There are a lot more sources of variables - here is their order of precedence:
- Variables from the -k/–key-values CLI flag
- Variables defined in cells
- Variables defined in the code section
- Builtin variables
pub fn is_function_defined(&self, fn_name: &str) -> bool
pub fn is_variable_defined(&self, var_name: &str) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Template<'a>
impl<'a> !Send for Template<'a>
impl<'a> !Sync for Template<'a>
impl<'a> Unpin for Template<'a>
impl<'a> !UnwindSafe for Template<'a>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
Adds separators according to the given
SeparatorPolicy. Read moresource§fn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Inserts a comma every three digits from the right. Read more
source§fn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Inserts a space every three digits from the right. Read more
source§fn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Inserts a period every three digits from the right. Read more
source§fn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Inserts an underscore every three digits from the right. Read more