This is probably still a bit of a long shot in Rust's developing type system, but is there a way to filter a tuple or hlist of references based on whether those types implement one or ideally multiple traits? I'm wondering if there's some unholy combination of frunk, hlists, facet, and/or feature(min_specialization) (or other relatively stable/safe nightly features) to do this.
Essentially a function where I feed in (&FooImplementsTraits, &BarDoesntImplement, &BazImplementsTraits) and get out (&FooImplementsTraits, &BazImplementsTraits) (or an HList equivalent). Is that possible in Rust's type system at this point?
I know there's this trick that uses the preference for inherent methods, but that wouldn't work at the generic level over tuples/hlists. For use case context, I'm trying to work on improvements to gecs to be less macro-dependent, but I'm stuck on being able to filter archetypes by what component types they hold.
Any nightly features or, at the very least, RFCs to follow that might make this possible? Doesn't have to be pretty if there's a dirty trick to make it work.
You can follow the breadcrumbs from here, but there's not much activity or tracking. with_negative_coherence is a related scarcely/non?-documented feature gate. I have no idea how far the feature gate may get you. Sorry that I can only give a starting point which may be a dead end.
It builds on negative impls which at least have seen some more active interest.