Struct handlebars::RenderContext
source · pub struct RenderContext<'reg> { /* private fields */ }
Expand description
The context of a render call
this context stores information of a render and a writer where generated content is written to.
Implementations
sourceimpl<'reg> RenderContext<'reg>
impl<'reg> RenderContext<'reg>
sourcepub fn new(root_template: Option<&'reg String>) -> RenderContext<'reg>
pub fn new(root_template: Option<&'reg String>) -> RenderContext<'reg>
Create a render context from a Write
pub fn derive(&self) -> RenderContext<'reg>
pub fn new_for_block(&self) -> RenderContext<'reg>
pub fn context(&self) -> Option<Rc<Context>>
pub fn set_context(&mut self, ctx: Context)
pub fn evaluate<'ctx>(
&self,
context: &'ctx Context,
path: &str,
strict: bool
) -> Result<&'ctx Json, RenderError>
pub fn evaluate_absolute<'ctx>(
&self,
context: &'ctx Context,
path: &str,
strict: bool
) -> Result<&'ctx Json, RenderError>
pub fn get_partial(&self, name: &str) -> Option<&&Template>
pub fn set_partial(&mut self, name: String, result: &'reg Template)
pub fn set_local_var(&mut self, name: String, value: Json)
pub fn clear_local_vars(&mut self)
pub fn promote_local_vars(&mut self)
pub fn demote_local_vars(&mut self)
pub fn get_local_var(&self, name: &str) -> Option<&Json>
pub fn is_current_template(&self, p: &str) -> bool
pub fn register_local_helper(
&mut self,
name: &str,
def: Box<dyn HelperDef + 'static>
) -> Option<Rc<Box<dyn HelperDef + 'static>>>
pub fn unregister_local_helper(&mut self, name: &str)
pub fn get_local_helper(
&self,
name: &str
) -> Option<Rc<Box<dyn HelperDef + 'static>>>
pub fn get_current_template_name(&self) -> Option<&'reg String>
pub fn set_current_template_name(&mut self, name: Option<&'reg String>)
pub fn get_root_template_name(&self) -> Option<&'reg String>
pub fn set_root_template_name(&mut self, name: Option<&'reg String>)
pub fn is_disable_escape(&self) -> bool
pub fn set_disable_escape(&mut self, disable: bool)
pub fn get_path(&self) -> &String
pub fn set_path(&mut self, path: String)
pub fn get_local_path_root(&self) -> &VecDeque<String>
pub fn push_local_path_root(&mut self, path: String)
pub fn pop_local_path_root(&mut self)
pub fn push_block_context<T>(&mut self, ctx: &T) -> Result<(), RenderError>where
T: Serialize,
pub fn pop_block_context(&mut self)
pub fn evaluate_in_block_context(
&self,
local_path: &str
) -> Result<Option<&Json>, RenderError>
Trait Implementations
sourceimpl<'reg> Clone for RenderContext<'reg>
impl<'reg> Clone for RenderContext<'reg>
sourcefn clone(&self) -> RenderContext<'reg>
fn clone(&self) -> RenderContext<'reg>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl<'reg> !RefUnwindSafe for RenderContext<'reg>
impl<'reg> !Send for RenderContext<'reg>
impl<'reg> !Sync for RenderContext<'reg>
impl<'reg> Unpin for RenderContext<'reg>
impl<'reg> !UnwindSafe for RenderContext<'reg>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more