diff --git a/src/middleware.rs b/src/middleware.rs index 0ebd9194a..56cd2976f 100644 --- a/src/middleware.rs +++ b/src/middleware.rs @@ -97,15 +97,19 @@ impl HandlebarsEngine { } } - pub fn new(prefix: &str, suffix: &str) -> HandlebarsEngine { + pub fn from(prefix: &str, suffix: &str, custom: Handlebars) -> HandlebarsEngine { let eng = HandlebarsEngine { prefix: prefix.to_string(), suffix: suffix.to_string(), - registry: RwLock::new(Box::new(Handlebars::new())) + registry: RwLock::new(Box::new(custom)) }; eng.reload(); eng } + + pub fn new(prefix: &str, suffix: &str) -> HandlebarsEngine { + HandlebarsEngine::from(prefix,suffix, Handlebars::new()) + } } impl AfterMiddleware for HandlebarsEngine {