Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow closures to be added as functions. #22

Open
storyfeet opened this issue Jul 22, 2020 · 0 comments
Open

Allow closures to be added as functions. #22

storyfeet opened this issue Jul 22, 2020 · 0 comments

Comments

@storyfeet
Copy link

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>{
        ///...
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant