Storing closures on struct error: expected closure, found different closure

I'm having trouble storing async closures/closures-returning-futures on a struct in a library I'm writing. I've tried multiple different ways to do so that I've researched, such as boxing, but the error that I can't get around is: expected closure, found different closure quick_crawler/lib.rs at closures · mkralla11/quick_crawler · GitHub

Every closure in your program has its own unique type, even if they're identical. The type returned by store appears to contain the type of the closure as a generic parameter, so you're now trying to create a vector with two items of different types.

To make boxing work, you may have to explicitly cast the box to the dyn Fn version.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.