so am I right in thinking that every rust function with a generic return, e.g. collect(), sum(), into(), is implemented by constraining the return to implement some trait and then just calling that trait?
We wanted an API where you just give us a closure with the function body, so our context is just a boxed trait object for that (wrapped in our own closure to handle deserialization of arguments and serialization of return value) 2/
-
-
Actually it's not even a trait object. It's just a generic `Box<T>` -- anyway I found it super neat that you can do this even with `extern "C" fn`s. Just give it the generic type for the actual closure you passed it and you'll get what you need for C interop
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.