Struct csvpp::Template

source ·
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<'_>

source

pub fn write_object_file(&self, source_code: &SourceCode) -> Result<PathBuf>

source§

impl<'a> Template<'a>

source

pub fn compile(runtime: &'a Runtime) -> Result<Self>

source

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):

  1. Functions in the code section
  2. Builtin functions
Variable Precedence

There are a lot more sources of variables - here is their order of precedence:

  1. Variables from the -k/–key-values CLI flag
  2. Variables defined in cells
  3. Variables defined in the code section
  4. Builtin variables
source

pub fn is_function_defined(&self, fn_name: &str) -> bool

source

pub fn is_variable_defined(&self, var_name: &str) -> bool

Trait Implementations§

source§

impl<'a> Debug for Template<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Template<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> Separable for T
where T: Display,

source§

fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String

Adds separators according to the given SeparatorPolicy. Read more
source§

fn separate_with_commas(&self) -> String

Inserts a comma every three digits from the right. Read more
source§

fn separate_with_spaces(&self) -> String

Inserts a space every three digits from the right. Read more
source§

fn separate_with_dots(&self) -> String

Inserts a period every three digits from the right. Read more
source§

fn separate_with_underscores(&self) -> String

Inserts an underscore every three digits from the right. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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

§

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<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more