Skip to content

Implement Std traits for SceneInstanceReady#11003

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
daxpedda:scene-instance-ready-std
Dec 17, 2023
Merged

Implement Std traits for SceneInstanceReady#11003
alice-i-cecile merged 1 commit intobevyengine:mainfrom
daxpedda:scene-instance-ready-std

Conversation

@daxpedda
Copy link
Copy Markdown
Contributor

Objective

Being able to do:

ev_scene_ready.read().next().unwrap();

Which currently isn't possible because SceneInstanceReady doesn't implement Debug.

Solution

Implement Debug for SceneInstanceReady.


Changelog

Added

  • Implement Std traits for SceneInstanceReady.

@mockersf
Copy link
Copy Markdown
Member

ev_scene_ready.read().next().unwrap();

Which currently isn't possible because SceneInstanceReady doesn't implement Debug.

Could you expand on that? It shouldn't have any relation

@daxpedda
Copy link
Copy Markdown
Contributor Author

ev_scene_ready.read().next().unwrap();

Which currently isn't possible because SceneInstanceReady doesn't implement Debug.

Could you expand on that? It shouldn't have any relation

Uh, sorry, I forgot that unwrap() only requires E: Debug on Result<T, E> and not Option<T> (no E there).

My use-case actually looked like this:

use itertools::Itertools;

ev_scene_ready.read().exactly_one().unwrap();

See Itertools::exactly_one().

I also implemented PartialEq and Eq to make comparisons simpler, which I used afterwards to assert that this is all the same scene after I discovered #11002.

Personally I didn't need Clone and Copy, but it didn't look like it would hurt.

@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Scenes Composing and serializing ECS objects labels Dec 17, 2023
@matiqo15 matiqo15 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Dec 17, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 17, 2023
Merged via the queue into bevyengine:main with commit 9249856 Dec 17, 2023
daxpedda added a commit to daxpedda/bevy that referenced this pull request Dec 18, 2023
# Objective

Being able to do:
```rust
ev_scene_ready.read().next().unwrap();
```
Which currently isn't possible because `SceneInstanceReady` doesn't
implement `Debug`.

## Solution

Implement `Debug` for `SceneInstanceReady`.

---

## Changelog

### Added
- Implement Std traits for `SceneInstanceReady`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Scenes Composing and serializing ECS objects C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants