Struct handlebars::RenderContext
[−]
[src]
pub struct RenderContext<'a> { pub writer: &'a mut Write, pub current_template: Option<String>, pub root_template: Option<String>, pub disable_escape: bool, // some fields omitted }
The context of a render call
this context stores information of a render and a writer where generated content is written to.
Fields
writer: &'a mut Write
the Write
where page is generated
current_template: Option<String>
current template name
root_template: Option<String>
root template name
disable_escape: bool
Methods
impl<'a> RenderContext<'a>
[src]
fn new(
ctx: Context,
local_helpers: &'a mut HashMap<String, Rc<Box<HelperDef + 'static>>>,
w: &'a mut Write
) -> RenderContext<'a>
ctx: Context,
local_helpers: &'a mut HashMap<String, Rc<Box<HelperDef + 'static>>>,
w: &'a mut Write
) -> RenderContext<'a>
Create a render context from a Write
fn derive(&mut self) -> RenderContext
fn with_context(&mut self, ctx: Context) -> RenderContext
fn get_partial(&self, name: &str) -> Option<Template>
fn set_partial(&mut self, name: String, result: Template)
fn get_path(&self) -> &String
fn set_path(&mut self, path: String)
fn get_local_path_root(&self) -> &VecDeque<String>
fn push_local_path_root(&mut self, path: String)
fn pop_local_path_root(&mut self)
fn set_local_var(&mut self, name: String, value: Json)
fn clear_local_vars(&mut self)
fn promote_local_vars(&mut self)
fn demote_local_vars(&mut self)
fn get_local_var(&self, name: &String) -> Option<&Json>
fn writer(&mut self) -> &mut Write
fn push_block_context<T>(&mut self, ctx: &T) -> Result<(), RenderError> where
T: Serialize,
T: Serialize,
fn pop_block_context(&mut self)
fn evaluate_in_block_context(
&self,
local_path: &str
) -> Result<Option<&Json>, RenderError>
&self,
local_path: &str
) -> Result<Option<&Json>, RenderError>
fn is_current_template(&self, p: &str) -> bool
fn context(&self) -> &Context
fn context_mut(&mut self) -> &mut Context
fn register_local_helper(
&mut self,
name: &str,
def: Box<HelperDef + 'static>
) -> Option<Rc<Box<HelperDef + 'static>>>
&mut self,
name: &str,
def: Box<HelperDef + 'static>
) -> Option<Rc<Box<HelperDef + 'static>>>