-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SystemInput
tuples up to 8 elements
#16814
base: main
Are you sure you want to change the base?
Conversation
@spectria-limina you were poking at this; can I get your review here? |
LGTM |
@@ -11,6 +13,9 @@ use crate::{bundle::Bundle, prelude::Trigger, system::System}; | |||
/// - [`InMut<T>`]: For mutable references to values | |||
/// - [`Trigger<E, B>`]: For [`ObserverSystem`]s | |||
/// - [`StaticSystemInput<I>`]: For arbitrary [`SystemInput`]s in generic contexts | |||
/// - Tuples of [`SystemInput`]s up to 8 elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also be documented on In
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
used to be the only way to pass input into systems, but given it's now just one of the multiple SystemInput
types, I don't think In
needs to be treated any differently from the others. I have added an extra note on all of the input types to check the trait for more information, however. I also added an example to the docs of using tuples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprisingly simple and well-tested. I think we can probably do a bit better with docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor gripe around max tuple size documentation that isn't even specific to this PR. Otherwise, this just looks like a nice change!
#[doc(fake_variadic)] | ||
impl_system_input_tuple, | ||
0, | ||
8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a problem with this PR specifically, but I feel like Bevy should probably just have a constant somewhere for LONGEST_REASONABLE_TUPLE
, instead of each site picking a somewhat random value (I think I've seen 12, 15, and 16, now also 8).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, I just think its way less reasonable to have large-arity input tuples when even using system input at all is somewhat uncommon. So I'd prefer if we could (potentially) save some compilation time by not implementing for arities that are highly unlikely to be used in practice.
Objective
SystemInput
up to par withSystemParam
for tuple support.Solution
SystemInput
type (it's incredibly simple to do).Testing
Showcase
Tuples of arbitrary
SystemInput
s are now supported: