Trait Runtime

Source
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: Runtime + ?Sized> Runtime for &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§