
# Objective - First step towards #279 ## Solution Makes the necessary internal data structure changes in order to allow system removal to be added in a future PR: `Vec`s storing systems and system sets in `ScheduleGraph` have been replaced with `SlotMap`s. See the included migration guide for the required changes. ## Testing Internal changes only and no new features *should* mean no new tests are requried.
35 lines
1.5 KiB
Markdown
35 lines
1.5 KiB
Markdown
---
|
|
title: Schedule SlotMaps
|
|
pull_requests: [19352]
|
|
---
|
|
|
|
In order to support removing systems from schedules, `Vec`s storing `System`s and
|
|
`SystemSet`s have been replaced with `SlotMap`s which allow safely removing and
|
|
reusing indices. The maps are respectively keyed by `SystemKey`s and `SystemSetKey`s.
|
|
|
|
The following signatures were changed:
|
|
|
|
- `NodeId::System`: Now stores a `SystemKey` instead of a plain `usize`
|
|
- `NodeId::Set`: Now stores a `SystemSetKey` instead of a plain `usize`
|
|
- `ScheduleBuildPass::collapse_set`: Now takes the type-specific keys. Wrap them back into a `NodeId` if necessary.
|
|
- The following functions now return the type-specific keys. Wrap them back into a `NodeId` if necessary.
|
|
- `Schedule::systems`
|
|
- `ScheduleGraph::systems`
|
|
- `ScheduleGraph::system_sets`
|
|
- `ScheduleGraph::conflicting_systems`
|
|
- Use the appropriate key types to index these structures rather than bare `usize`s:
|
|
- `ScheduleGraph::systems` field
|
|
- `ScheduleGraph::system_conditions`
|
|
- The following functions now take the type-specific keys. Use pattern matching to extract them from `NodeId`s, if necessary:
|
|
- `ScheduleGraph::get_system_at`
|
|
- `ScheduleGraph::system_at`
|
|
- `ScheduleGraph::get_set_at`
|
|
- `ScheduleGraph::set_at`
|
|
- `ScheduleGraph::get_set_conditions_at`
|
|
- `ScheduleGraph::set_conditions_at`
|
|
|
|
The following functions were removed:
|
|
|
|
- `NodeId::index`: You should match on and use the `SystemKey` and `SystemSetKey` instead.
|
|
- `NodeId::cmp`: Use the `PartialOrd` and `Ord` traits instead.
|