[−][src]Struct hatter::prelude::Env
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,