lloydmeta / frunk

Funktional generic type-level programming in Rust: HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid and friends.
https://beachape.com/frunk/
MIT License
1.28k stars 58 forks source link

Add a &self context to Func #138

Open ExpHP opened 5 years ago

ExpHP commented 5 years ago

If #137 gets merged, then Func will take no context while FuncMut takes a &mut context. For consistency, Func should be revised to take a &self context.

IMO, poly_fn! still should remain limited to defining Funcs with unit context, because it is too complicated to define an ergonomical grammar for a macro that allows the function to capture anyhing. In other words, to take advantage of this new feature will require a manual Func impl.

Centril commented 5 years ago

I'm working on a proposal to add generic closures to Rust itself in any case so that seems OK. :)

ExpHP commented 5 years ago

That sounds boss.