Struct handlebars::BlockContext[][src]

pub struct BlockContext<'reg> { /* fields omitted */ }
Expand description

A data structure holds contextual data for current block scope.

Implementations

impl<'reg> BlockContext<'reg>[src]

pub fn new() -> BlockContext<'reg>[src]

create a new BlockContext with default data

pub fn set_local_var(&mut self, name: &str, value: Json)[src]

set a local variable into current scope

pub fn get_local_var(&self, name: &str) -> Option<&Json>[src]

get a local variable from current scope

pub fn base_path(&self) -> &Vec<String>[src]

borrow a reference to current scope’s base path all paths inside this block will be relative to this path

pub fn base_path_mut(&mut self) -> &mut Vec<String>[src]

borrow a mutable reference to the base path

pub fn base_value(&self) -> Option<&Json>[src]

borrow the base value

pub fn set_base_value(&mut self, value: Json)[src]

set the base value

pub fn get_block_param(
    &self,
    block_param_name: &str
) -> Option<&BlockParamHolder>
[src]

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}}

pub fn set_block_params(&mut self, block_params: BlockParams<'reg>)[src]

Set a block parameter into this block.

Trait Implementations

impl<'reg> Clone for BlockContext<'reg>[src]

fn clone(&self) -> BlockContext<'reg>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'reg> Debug for BlockContext<'reg>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'reg> Default for BlockContext<'reg>[src]

fn default() -> BlockContext<'reg>[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl<'reg> RefUnwindSafe for BlockContext<'reg>

impl<'reg> Send for BlockContext<'reg>

impl<'reg> Sync for BlockContext<'reg>

impl<'reg> Unpin for BlockContext<'reg>

impl<'reg> UnwindSafe for BlockContext<'reg>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.