Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>Before, the function we passed to do_work_and_then was pure: it didn’t have any associated data, so you could just pass it around as a function pointer (fn(i32)) and all was grand. However, this new function in that last example is a closure

Those are different things! Anything pure (i.e. returns same output) could still require a closure if it captures heap-allocated data - which in Rust would entail free-ing and transferring ownership and all that.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: