templater: generalize merge_fn_map() helper

The global function type is slightly different from method calls.
This commit is contained in:
Yuya Nishihara 2024-03-14 20:14:12 +09:00
parent fa9cb72445
commit 85f2f3a439

View file

@ -262,10 +262,7 @@ pub struct CoreTemplateBuildFnTable<'a, L: TemplateLanguage<'a> + ?Sized> {
// TODO: add global functions table?
}
pub fn merge_fn_map<'a, L: TemplateLanguage<'a> + ?Sized, T>(
base: &mut TemplateBuildMethodFnMap<'a, L, T>,
extension: TemplateBuildMethodFnMap<'a, L, T>,
) {
pub fn merge_fn_map<'s, F>(base: &mut HashMap<&'s str, F>, extension: HashMap<&'s str, F>) {
for (name, function) in extension {
if base.insert(name, function).is_some() {
panic!("Conflicting template definitions for '{name}' function");