mage 0.2.0

An intuitive and powerful template engine.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

use std::fs::File;
use std::prelude::v1::*;
use std::io::prelude::*;
use std::io;
use std::path::{PathBuf, Path};


pub fn read<P: AsRef<Path>>(file_path: P) -> Result<String, io::Error> {
    let mut file = File::open(file_path)?;
    let mut content = String::new();
    file.read_to_string(&mut content)?;
    Ok(content)
}

pub fn resolve<T: AsRef<Path>, P: AsRef<Path>>(root: T, relative: P) -> PathBuf {
    root.as_ref().join(relative)
}