pub trait Runtime {
    // Required methods
    fn partials(&self) -> &dyn PartialStore;
    fn name(&self) -> Option<KStringRef<'_>>;
    fn roots(&self) -> BTreeSet<KStringCow<'_>>;
    fn try_get(&self, path: &[ScalarCow<'_>]) -> Option<ValueCow<'_>>;
    fn get(&self, path: &[ScalarCow<'_>]) -> Result<ValueCow<'_>>;
    fn set_global(&self, name: KString, val: Value) -> Option<Value>;
    fn set_index(&self, name: KString, val: Value) -> Option<Value>;
    fn get_index<'a>(&'a self, name: &str) -> Option<ValueCow<'a>>;
    fn registers(&self) -> &Registers;
}
Expand description

State for rendering a template

Required Methods§

source

fn partials(&self) -> &dyn PartialStore

Partial templates for inclusion.

source

fn name(&self) -> Option<KStringRef<'_>>

The name of the currently active template.

source

fn roots(&self) -> BTreeSet<KStringCow<'_>>

All available values

source

fn try_get(&self, path: &[ScalarCow<'_>]) -> Option<ValueCow<'_>>

Recursively index into the stack.

source

fn get(&self, path: &[ScalarCow<'_>]) -> Result<ValueCow<'_>>

Recursively index into the stack.

source

fn set_global(&self, name: KString, val: Value) -> Option<Value>

Sets a value in the global runtime.

source

fn set_index(&self, name: KString, val: Value) -> Option<Value>

Used by increment and decrement tags

source

fn get_index<'a>(&'a self, name: &str) -> Option<ValueCow<'a>>

Used by increment and decrement tags

source

fn registers(&self) -> &Registers

Unnamed state for plugins during rendering

Implementations on Foreign Types§

source§

impl<'r, R: Runtime + ?Sized> Runtime for &'r R

source§

fn partials(&self) -> &dyn PartialStore

source§

fn name(&self) -> Option<KStringRef<'_>>

source§

fn roots(&self) -> BTreeSet<KStringCow<'_>>

source§

fn try_get(&self, path: &[ScalarCow<'_>]) -> Option<ValueCow<'_>>

source§

fn get(&self, path: &[ScalarCow<'_>]) -> Result<ValueCow<'_>>

source§

fn set_global(&self, name: KString, val: Value) -> Option<Value>

source§

fn set_index(&self, name: KString, val: Value) -> Option<Value>

source§

fn get_index<'a>(&'a self, name: &str) -> Option<ValueCow<'a>>

source§

fn registers(&self) -> &Registers

Implementors§