Infer StableInterpolate on tuples#15931
Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
Can you add the fake_variadics doc attribute? We've added this elsewhere and it really improves the rustdoc output.
I would suggest using the all_tuples macro here, but it's good to not pull in that dependency.
NiseVoid
left a comment
There was a problem hiding this comment.
Kind of cursed, but it does look like this is the only way without introducing new deps.
|
could you try to use https://docs.rs/bevy/latest/bevy/utils/macro.all_tuples.html? |
Do you know how to do that outside of the context of the
It doesn't work anyway :( I spent quite a while trying to do it that way and reached the conclusion that it's basically impossible. |
alice-i-cecile
left a comment
There was a problem hiding this comment.
I'm fine with this for now :)
|
@BenjaminBrienen @bash y'all have any advice? You were very helpful for this in #15387 |
For what it's worth, I got it working with a new version of |
|
I had the same errors he's describing. It only worked for me within |
|
Follow-up it is then ;) |
Yeah |
This is a follow-up to #15931 that adds `#[doc(fake_variadic)]` for improved docs output :)
…evyengine#16931) # Objective Now that `variadics_please` has a 1.1 release, we can re-implement the original solution. ## Solution Copy-paste the code from the [original PR](bevyengine#15931) branch :)
…evyengine#16931) # Objective Now that `variadics_please` has a 1.1 release, we can re-implement the original solution. ## Solution Copy-paste the code from the [original PR](bevyengine#15931) branch :)
…evyengine#16931) # Objective Now that `variadics_please` has a 1.1 release, we can re-implement the original solution. ## Solution Copy-paste the code from the [original PR](bevyengine#15931) branch :)
Objective
Make
StableInterpolate"just work" on tuples whose parts are eachStableInterpolatetypes. These types arise notably throughCurve::zip(or just through explicit mapping of a similar form). It would otherwise be kind of frustrating to stumble upon such a thing and then realize that, e.g., automatic resampling just doesn't work, even though there is a very "obvious" way to do it.Solution
Infer
StableInterpolateon tuples of up to size 11. I can make that number bigger, if desired. Unfortunately, I don't think that our standard "fake variadics" tools actually work for this; the anonymous field accessors of tuples are:ttfor purposes of macro expansion, which means that you can't simplify away the identifiers by doing something clever like using recursion (which would work if they were:expr). Maybe someone who knows some incredibly dark magic could chime in with a better solution.The expanded impls look like this:
Testing
Expanded macros; it compiles.
Future
Make a version of the fake variadics workflow that supports this kind of thing.