bevy/crates/bevy_ecs/src/query
James Liu dc40cd134f
Remove ComponentStorage and associated types (#12311)
# Objective
When doing a final pass for #3362, it appeared that `ComponentStorage`
as a trait, the two types implementing it, and the associated type on
`Component` aren't really necessary anymore. This likely was due to an
earlier constraint on the use of consts in traits, but that definitely
doesn't seem to be a problem in Rust 1.76.

## Solution
Remove them.

---

## Changelog
Changed: `Component::Storage` has been replaced with
`Component::STORAGE_TYPE` as a const.
Removed: `bevy::ecs::component::ComponentStorage` trait
Removed: `bevy::ecs::component::TableStorage` struct
Removed: `bevy::ecs::component::SparseSetStorage` struct

## Migration Guide
If you were manually implementing `Component` instead of using the
derive macro, replace the associated `Storage` associated type with the
`STORAGE_TYPE` const:

```rust
// in Bevy 0.13
impl Component for MyComponent {
    type Storage = TableStorage;
}
// in Bevy 0.14
impl Component for MyComponent {
    const STORAGE_TYPE: StorageType = StorageType::Table;
}
```

Component is no longer object safe. If you were relying on `&dyn
Component`, `Box<dyn Component>`, etc. please [file an issue
](https://github.com/bevyengine/bevy/issues) to get [this
change](https://github.com/bevyengine/bevy/pull/12311) reverted.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-03-05 15:54:52 +00:00
..
access.rs Expose query accesses (#11700) 2024-02-10 15:22:07 +00:00
builder.rs remove repetitive code (#12270) 2024-03-03 07:58:22 +00:00
error.rs Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
fetch.rs Remove ComponentStorage and associated types (#12311) 2024-03-05 15:54:52 +00:00
filter.rs Remove ComponentStorage and associated types (#12311) 2024-03-05 15:54:52 +00:00
iter.rs Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
mod.rs Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
par_iter.rs Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
state.rs Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
world_query.rs bevy_ecs address trivial cases of unsafe_op_in_unsafe_fn (#11861) 2024-02-22 00:04:38 +00:00