Use GAT to live our Query API dream
This is an experimental PR showing how the soon-to-be-stabilisedGAT feature can help us generate less code.
I think GATs also stabilize async in traits? That way we could remove our dependency on async_trait A lot of improvements!
There seems to be some uncertainty about the stabilization. I really hope it goes through :sweat_smile: .
:tada: GATs have been merged :) Barring some further issues, I think that means we can expect them on stable in about 3 months or so.
Unfortunately, this solution has reached a dead end. The orphan rule prevents us from generating the Borrow trait for types from other crates. The truth is that we don't need GAT, it would not improve performance or compile time. If we want to make the generated code smaller or easier to read, we can always use macro_rules to de-duplicate the code generation.