[][src]Struct mhtemplate::Context

pub struct Context(_);

Evaluation context containing variable values.

A context can be created from the programs enviroment:

# use mhtemplate::Context;
let vars = std::env::vars();
let ctx  = Context::from(vars);

Methods

impl Context[src]

pub fn new() -> Self[src]

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

pub fn var_mut(&mut self, name: &str) -> Option<&mut String>[src]

pub fn set_var(&mut self, name: String, val: String) -> Option<String>[src]

pub fn iter_vars(&self) -> Iter<String, String>[src]

pub fn iter_vars_mut(&mut self) -> IterMut<String, String>[src]

Trait Implementations

impl Clone for Context[src]

impl Debug for Context[src]

impl Default for Context[src]

impl Eq for Context[src]

impl<'_> From<&'_ Context> for Context[src]

impl From<HashMap<String, String, RandomState>> for Context[src]

fn from(vars: HashMap<String, String>) -> Self[src]

let mut vars = HashMap::new();
vars.insert(String::from("one"), String::from("1"));
let mut ctx = Context::from(vars);

impl From<Vars> for Context[src]

fn from(vars: Vars) -> Self[src]

let vars = std::env::vars();
let ctx  = Context::from(vars);

impl<'_> Index<&'_ str> for Context[src]

type Output = String

The returned type after indexing.

impl<'_> IndexMut<&'_ str> for Context[src]

impl PartialEq<Context> for Context[src]

impl StructuralEq for Context[src]

impl StructuralPartialEq for Context[src]

Auto Trait Implementations

impl RefUnwindSafe for Context

impl Send for Context

impl Sync for Context

impl Unpin for Context

impl UnwindSafe for Context

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.