[<<][rust][>>][..]
Mon Feb 2 14:27:41 EST 2015

Function pointers

So I want to parameterize a function with a kind of continuation,
i.e. some sink that takes a value while i'm going through a loop.

How does it know its state, and does the function type need to reflect
this?

There are a couple of options: closures and the call operators [1][2].

(expected fn pointer, found closure) [3]

[1] http://doc.rust-lang.org/std/ops/trait.Fn.html
[2] http://doc.rust-lang.org/std/ops/trait.FnMut.html
[3] https://stackoverflow.com/questions/24979454/differences-between-fn-and-in-type-for-an-array-of-functions
[4] https://www.reddit.com/r/rust/comments/2lpdvn/callbacks/




[Reply][About]
[<<][rust][>>][..]