[][src]Struct hatter::Env

pub struct Env { /* fields omitted */ }

Env is the top-level environment in which a Hatter template is evaluated and rendered.

Implementations

impl Env[src]

pub fn new() -> Env[src]

New, top-level Env.

pub fn out(&mut self) -> String[src]

Return and clear output.

pub fn empty_args(&mut self) -> Args<'_>[src]

Create an empty Args struct, to call a helper function.

pub fn scope(&self) -> &Scope[src]

Nearest (currently active) scope.

pub fn push_scope(&mut self)[src]

Add a new scope to the stack, which becomes active.

pub fn pop_scope(&mut self)[src]

Kill the active scope.

pub fn mut_scope(&mut self) -> &mut Scope[src]

Nearest (currently active) scope.

pub fn var_exists(&self, key: &str) -> bool[src]

Does a value exist in this or any parent scopes?

pub fn lookup(&self, key: &str) -> Option<Ref<'_, Value>>[src]

Find a value, looking first in the most recently pushed scope.

pub fn set<V: Into<Value>>(&self, key: &str, val: V)[src]

Set a value to the nearest scope.

pub fn update<V: Into<Value>>(&self, key: &str, val: V)[src]

Set a value in a parent scope, or create it in the nearest.

pub fn print<V: Into<Value>>(&mut self, val: V)[src]

Add something to our render buffer without a trailing line.

pub fn render(&mut self, source: &str) -> Result<String>[src]

Render statements into a String.

pub fn block(&mut self, stmts: &[Stmt]) -> Result<Value>[src]

Evaluate a block of statements, returning the last one.

pub fn printed_block(&mut self, stmts: &[Stmt]) -> Result<Value>[src]

Evaluate a block of statements and print what each returns. "Outside of a tag, tags are printed. Inside of a tag, everything is printed."

pub fn eval_src(&mut self, src: &str) -> Result<Value>[src]

Evaluate source code, returning its Value.

pub fn eval(&mut self, stmt: &Stmt) -> Result<Value>[src]

Evaluate one statement, returning its Value.

Trait Implementations

impl Debug for Env[src]

impl Default for Env[src]

Auto Trait Implementations

impl !RefUnwindSafe for Env

impl !Send for Env

impl !Sync for Env

impl Unpin for Env

impl !UnwindSafe for Env

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.