#Getting the parameter index from all_tuples!
15 messages · Page 1 of 1 (latest)
what have you tried?
should be possible with a trait used to push tuple items to a vec
I need to convert them before they are pushed, though.
With the other crates, you can just get the tuple index.
yeah use your own trait, with your own impl being replicated by the macro
that impl could well be vec.push(tup.$n.into())
or something
Here's what I have - this doesn't work because $T is T0, not 0:
macro_rules! impl_class_names {
($($T:ident),*) => {
impl<$($T: ConditionalClassName),*> ClassNamesTuple for ($($T,)*) {
fn to_vec(self) -> Vec<Option<String>> {
Vec::from([$(self.$T.to_class()),* ])
}
}
};
}
With impl_trait_for_tuples if you say self.T it knows you want an index, not a type name.
ah hmm
I'm using that package now, but I wanted to migrate to the bevy solution and reduce my dependencies.
yeah looking at how its used in bevy i think its meant as a type system only thing?
Hmmm, ok
mainly used to act on types, like in queries, bundles, etc