incrust 0.1.1

Template engine inspired by Jinja2
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::collections::hash_map::{HashMap};
use std::fs::File;
use std::path::{Path, PathBuf};

use ::abc::{Loader, LoadResult, LoadError};

pub type DictLoader = HashMap<String, String>;

impl Loader for HashMap<String, String> {
    fn load(&self, name: &str) -> LoadResult {
        match self.get(name) {
            Some(entry) => Ok(entry.to_owned()),
            None        => Err(LoadError::NotFound),
        }
    }
}