mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
1e47604506
# Objective The schedule graph can easily confirm whether a set is contained or not. This helps me in my personal project where I write an extension trait for `Schedule` and I want to configure a specific set in its methods. The set in question has a run condition though and I don't want to add that condition to the same schedule as many times as the trait methods are called. Since the non-pub set is unknown to the schedule until then, a `contains_set` is sufficient. It is probably trivial to add a method that returns an `Option<NodeId>` as well but as I personally don't need it I did not add that. If it is desired I can do so here though. It might be unneeded to have a `contains_set` then because one could check `is_some` on the returned id in that case. An argument against that is that future changes may be easier if only a `contains_set` needs to be ported. ## Solution Added `ScheduleGraph::contains_set`. ## Testing I put the below showcase code into a temporary unit test and it worked. If wanted I add it as a test too but I did not see that other more somewhat complicated methods have tests --- ## Showcase ```rs #[derive(ScheduleLabel, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)] struct MySchedule; #[derive(SystemSet, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)] struct MySet; let mut schedule = Schedule::new(MySchedule); assert_eq!(schedule.graph().contains_set(MySet), false); schedule.configure_sets(MySet); assert_eq!(schedule.graph().contains_set(MySet), true); ``` |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_image | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mesh | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_remote | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |