Local with required config as a const generic parameter#2463
Local with required config as a const generic parameter#2463mockersf wants to merge 3 commits intobevyengine:mainfrom
Local with required config as a const generic parameter#2463Conversation
|
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
Requiredsystem param #2440, but with a const generic parameter onLocalinstead of a new typeSolution
Either:
FromWorldimpl, useLocal<T, true>config, useLocal<T, false>If the parameter is
false, the bound for T onFromWorldis lifted.Ideally, I would want the
Localtype 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...