bevy/benches/benches/bevy_ecs
Shane 484721be80
Have EntityCommands methods consume self for easier chaining (#14897)
# Objective

Fixes #14883

## Solution

Pretty simple update to `EntityCommands` methods to consume `self` and
return it rather than taking `&mut self`. The things probably worth
noting:

* I added `#[allow(clippy::should_implement_trait)]` to the `add` method
because it causes a linting conflict with `std::ops::Add`.
* `despawn` and `log_components` now return `Self`. I'm not sure if
that's exactly the desired behavior so I'm happy to adjust if that seems
wrong.

## Testing

Tested with `cargo run -p ci`. I think that should be sufficient to call
things good.

## Migration Guide

The most likely migration needed is changing code from this:

```
        let mut entity = commands.get_or_spawn(entity);

        if depth_prepass {
            entity.insert(DepthPrepass);
        }
        if normal_prepass {
            entity.insert(NormalPrepass);
        }
        if motion_vector_prepass {
            entity.insert(MotionVectorPrepass);
        }
        if deferred_prepass {
            entity.insert(DeferredPrepass);
        }
```

to this:

```
        let mut entity = commands.get_or_spawn(entity);

        if depth_prepass {
            entity = entity.insert(DepthPrepass);
        }
        if normal_prepass {
            entity = entity.insert(NormalPrepass);
        }
        if motion_vector_prepass {
            entity = entity.insert(MotionVectorPrepass);
        }
        if deferred_prepass {
            entity.insert(DeferredPrepass);
        }
```

as can be seen in several of the example code updates here. There will
probably also be instances where mutable `EntityCommands` vars no longer
need to be mutable.
2024-08-26 18:24:59 +00:00
..
components Use single threaded executor for archetype benches (#9835) 2023-09-18 16:06:42 +00:00
events fix deprecation warning in bench (#9823) 2023-09-16 09:27:13 +00:00
fragmentation Skip empty archetype/table (#14749) 2024-08-15 14:07:20 +00:00
iteration Opportunistically use dense iteration for archetypal iteration (#14049) 2024-08-02 21:18:15 +00:00
observers Recalibrated observe benchmark (#14381) 2024-07-18 18:25:33 +00:00
scheduling Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
world Have EntityCommands methods consume self for easier chaining (#14897) 2024-08-26 18:24:59 +00:00
benches.rs Skip empty archetype/table (#14749) 2024-08-15 14:07:20 +00:00
change_detection.rs Fair Change Detection Benchmarking (#11173) 2024-06-26 12:46:41 +00:00
empty_archetypes.rs Move schedule name into Schedule (#9600) 2023-08-28 20:44:48 +00:00