[−][src]Struct mhtemplate::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]
impl<'_> Index<&'_ str> for Context
[src]
type Output = String
The returned type after indexing.
fn index(&self, index: &str) -> &Self::Output
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,