Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Std traits for SceneInstanceReady #11003

Merged
merged 1 commit into from Dec 17, 2023

Conversation

daxpedda
Copy link
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
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
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 simple quality-of-life change that makes Bevy easier to use A-Scenes Serialized ECS data stored on the disk 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
26 checks passed
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 Serialized ECS data stored on the disk C-Usability A simple 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.

None yet

5 participants