-
-
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
Local
with required config as a const generic parameter
#2463
Conversation
I prefer this solution in general, but would like to hold off for a prettier version. I suppose the churn isn't too bad; this is not a particularly prominent feature and the refactor would be easy. Overall, making sure that the configured and defaulted versions of |
once we can use an enum, we could have more control on how it's initialized: enum LocalType {
FromWorld,
Default, // now separate from FromWorld
NeedConfig
} |
Ooh this is a clever take / a pattern that wasn't on my radar. I'd also prefer to hold off until const generic defaults are an option (and ideally, enums). |
it seems feature |
We could already use something like this design, if we substitute a module with 2 unit structs instead of an enum: mod local_mode {
struct FromWorld;
struct NeedsConfig;
} |
Just upgrade the compiler we use to nightly and all our problems are solved 😉 |
As of #3633, this no longer makes sense. |
# Objective - Fix the ugliness of the `config` api. - Supercedes bevyengine#2440, bevyengine#2463, bevyengine#2491 ## Solution - Since bevyengine#2398, capturing closure systems have worked. - Use those instead where we needed config before - Remove the rest of the config api. - Related: bevyengine#2777
Objective
Required
system param #2440, but with a const generic parameter onLocal
instead of a new typeSolution
Either:
FromWorld
impl, useLocal<T, true>
config
, useLocal<T, false>
If the parameter is
false
, the bound for T onFromWorld
is lifted.Ideally, I would want the
Local
type to be:Then my system would be:
But this is not possible in Rust for now 😞 :
Those are the two top issues in "what's next", so hopefully they should come soonish...