mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
4f57f380c7
# Objective The `SystemParamFunction` (and `ExclusiveSystemParamFunction`) trait is very cumbersome to use, due to it requiring four generic type parameters. These are currently all used as marker parameters to satisfy rust's trait coherence rules. ### Example (before) ```rust pub fn pipe<AIn, Shared, BOut, A, AParam, AMarker, B, BParam, BMarker>( mut system_a: A, mut system_b: B, ) -> impl FnMut(In<AIn>, ParamSet<(AParam, BParam)>) -> BOut where A: SystemParamFunction<AIn, Shared, AParam, AMarker>, B: SystemParamFunction<Shared, BOut, BParam, BMarker>, AParam: SystemParam, BParam: SystemParam, ``` ## Solution Turn the `In`, `Out`, and `Param` generics into associated types. Merge the marker types together to retain coherence. ### Example (after) ```rust pub fn pipe<A, B, AMarker, BMarker>( mut system_a: A, mut system_b: B, ) -> impl FnMut(In<A::In>, ParamSet<(A::Param, B::Param)>) -> B::Out where A: SystemParamFunction<AMarker>, B: SystemParamFunction<BMarker, In = A::Out>, ``` --- ## Changelog + Simplified the `SystemParamFunction` and `ExclusiveSystemParamFunction` traits. ## Migration Guide For users of the `SystemParamFunction` trait, the generic type parameters `In`, `Out`, and `Param` have been turned into associated types. The same has been done with the `ExclusiveSystemParamFunction` trait. |
||
---|---|---|
.. | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |