seancarroll/victors

Figure Out How to Capture Variables in Closures

Opened this issue · 0 comments

Currently this library is not very useful because control/candidates aka "behaviors" are typed as fn which does not allow them to the associated closures to capture closures which means you cant do much with them.

I've tried to switch over to FnOnce however since I'm keeping the behaviors in a vec I get compiler errors when attempting to iterate over candidates as a move occurs. I'm not yet sure how to structure the code yet to support the desired behavior. I feel like this would be similar to what Rust web frameworks(Actix, Hyper, Tower) do in regards to middleware but I do not yet comprehend how those work