Skip to content

Allow closures to be added as functions. #22

@storyfeet

Description

@storyfeet

Happy to write the PR for this, but is there any chance you'd consider allowing adding Closures to the function map.

I used this all the time in Go, and now in rust I'd really like to.

Maybe another function

pub enum MapFunc{
    Closure(Box<Fn(&[Value])->Result<Value,String>),
    Static(fn(&[Value]->Result<Value,String>),
}

//Then add the function
impl Template {
    add_closure(f:Box<Fn(&[Value])->Result<Value,String>{
        ///...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions