cookie_cutter_core 0.2.0

A feature-rich template engine with context aware escaping and both runtime and compiletime compilation
Documentation
use std::collections::BTreeMap;

use crate::{Escaper, Templates};

pub mod value;
pub use value::Value;

mod error;
pub use error::Error;
pub(crate) use error::WRONG_TYPE_MESSAGE;

mod context;
pub(crate) use context::write_tmpl;

pub(crate) fn tmpl_output<Esc: Escaper>(
    tmpls: &Templates<Esc>,
    index: usize,
    args: BTreeMap<String, Value>,
) -> Result<String, Error> {
    let mut result = String::new();

    write_tmpl(&mut result, tmpls, index, args)?;

    Ok(result)
}