pub struct BlockContext<'rc> { /* private fields */ }
Expand description
A data structure holds contextual data for current block scope.
Implementations§
Source§impl<'rc> BlockContext<'rc>
impl<'rc> BlockContext<'rc>
Sourcepub fn new() -> BlockContext<'rc>
pub fn new() -> BlockContext<'rc>
create a new BlockContext
with default data
Sourcepub fn set_local_var(&mut self, name: &str, value: Json)
pub fn set_local_var(&mut self, name: &str, value: Json)
set a local variable into current scope
Sourcepub fn local_variables_mut(&mut self) -> &mut LocalVars
pub fn local_variables_mut(&mut self) -> &mut LocalVars
Get mutable access to the local variables
Sourcepub fn get_local_var(&self, name: &str) -> Option<&Json>
pub fn get_local_var(&self, name: &str) -> Option<&Json>
get a local variable from current scope
Sourcepub fn base_path(&self) -> &Vec<String>
pub fn base_path(&self) -> &Vec<String>
borrow a reference to current scope’s base path all paths inside this block will be relative to this path
Sourcepub fn base_path_mut(&mut self) -> &mut Vec<String>
pub fn base_path_mut(&mut self) -> &mut Vec<String>
borrow a mutable reference to the base path
Sourcepub fn base_value(&self) -> Option<&Json>
pub fn base_value(&self) -> Option<&Json>
borrow the base value
Sourcepub fn set_base_value(&mut self, value: Json)
pub fn set_base_value(&mut self, value: Json)
set the base value
Sourcepub fn get_block_param(
&self,
block_param_name: &str,
) -> Option<&BlockParamHolder>
pub fn get_block_param( &self, block_param_name: &str, ) -> Option<&BlockParamHolder>
Get a block parameter from this block. Block parameters needed to be supported by the block helper. The typical syntax for block parameter is:
{{#myblock param1 as |block_param1|}}
...
{{/myblock}}
Sourcepub fn set_block_params(&mut self, block_params: BlockParams<'rc>)
pub fn set_block_params(&mut self, block_params: BlockParams<'rc>)
Reassign the block parameters for this block.
Sourcepub fn set_block_param(&mut self, key: &'rc str, value: BlockParamHolder)
pub fn set_block_param(&mut self, key: &'rc str, value: BlockParamHolder)
Set a block parameter into this block.
Trait Implementations§
Source§impl<'rc> Clone for BlockContext<'rc>
impl<'rc> Clone for BlockContext<'rc>
Source§fn clone(&self) -> BlockContext<'rc>
fn clone(&self) -> BlockContext<'rc>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'rc> Debug for BlockContext<'rc>
impl<'rc> Debug for BlockContext<'rc>
Source§impl<'rc> Default for BlockContext<'rc>
impl<'rc> Default for BlockContext<'rc>
Source§fn default() -> BlockContext<'rc>
fn default() -> BlockContext<'rc>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'rc> Freeze for BlockContext<'rc>
impl<'rc> RefUnwindSafe for BlockContext<'rc>
impl<'rc> Send for BlockContext<'rc>
impl<'rc> Sync for BlockContext<'rc>
impl<'rc> Unpin for BlockContext<'rc>
impl<'rc> UnwindSafe for BlockContext<'rc>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more