Skip to content

Code reorganization to facilitate planned Added/Changed extensions #29

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

Merged
merged 4 commits into from
Dec 12, 2022

Conversation

bzm3r
Copy link

@bzm3r bzm3r commented Dec 10, 2022

lib.rs is becoming quite unwieldy with the new extensions planned to Added/Changed: for instance, there will be new WorldQuery adapters, ReadTraits iterators, and new WriteTraits iterators. In order to make the file easier to navigate, and thereby mitigate the risk of errors, I think it will be useful to reorganize the code

@bzm3r bzm3r changed the title Code reorganization to facilitate planned Added/Changed extension` Code reorganization to facilitate planned Added/Changed extensions Dec 10, 2022
Copy link
Owner

@joseph-gio joseph-gio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are way too small. I don't see much benefit in separating multiple_read and multiple_write from all -- same with singular_* and one.

@bzm3r
Copy link
Author

bzm3r commented Dec 10, 2022

@JoJoJet ah, one and all will be the files that will grow the most in the upcoming changes. multiple_read and multiple_write will also see significant growth.

What I can do is keep this PR open, and work on the added/changed stuff. Once that PR is up, you'll have more information as to how things ought to be organized?

@bzm3r
Copy link
Author

bzm3r commented Dec 10, 2022

Okay, because it seemed that I can keep the singular_* files small even after change detection, I've collapsed them into one.

But can have you a look at how multiple_read and multiple_write change here, and then decide whether they should still be collapsed: #30

@bzm3r bzm3r requested a review from joseph-gio December 10, 2022 22:32
@joseph-gio
Copy link
Owner

I will leave the decision up to you, but IMO it's fine to just merge those files. all.rs will be quite long, but that's okay.

Comment on lines +192 to +206
//! Trait queries support basic change detection filtration. So to get all the components that
//! implement the target trait, and have also changed in some way since the last tick, you can:
//! ```ignore
//! fn show_tooltips(
//! tooltips: Query<ChangedAll<&dyn Tooltip>>
//! // ...
//! ) {
//! for tooltip in &tooltips {
//! println!("changed tool tips: {}", tooltip.tooltip());
//! }
//! }
//! ```
//!
//! Similarly, there exist `ChangedOne`, `AddedOne`, and `AddedAll`.
//!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this belongs here?

@joseph-gio
Copy link
Owner

joseph-gio commented Dec 11, 2022

So, apparently cargo-rdme doesn't like re-exports, so that doc link on line 167 of lib.rs needs to be crate::one::One

@joseph-gio
Copy link
Owner

Github won't let me push to this branch, so I'm just going to go ahead and merge this, then apply my nitpicks in a follow-up PR.

@joseph-gio joseph-gio merged commit 43896e4 into joseph-gio:main Dec 12, 2022
@joseph-gio joseph-gio mentioned this pull request Dec 12, 2022
joseph-gio added a commit that referenced this pull request Dec 12, 2022
Fixes some nitpicks introduced by #29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants