-
Notifications
You must be signed in to change notification settings - Fork 220
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
Improve Join and Entities docs #313
Conversation
@@ -66,6 +66,75 @@ bitset_and!{A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P} | |||
/// The purpose of the `Join` trait is to provide a way | |||
/// to access multiple storages at the same time with | |||
/// the merged bit set. | |||
/// | |||
/// Joining component storages means that you'll only get values where | |||
/// for a given entity every storage has an associated component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we draw parallel to SQL? Or is that just confusing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find it very useful tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things I think would be a bit confusing.
src/join.rs
Outdated
/// | ||
/// let entities = world.read_resource::<EntitiesRes>(); | ||
/// // note: `EntitiesRes` is the fetched resource; we get back | ||
/// // `Fetch<EntitiesRes>` which has a typedef as `Entities`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the Entities
reference here is somewhat xonfusinf, maybe: "Fetch<EntitiesRes>
can also be referred to by Entities
which is a shorthand type definition to the former Fetch
type."
src/world/mod.rs
Outdated
/// let pos_storage = world.read::<Pos>(); | ||
/// let vel_storage = world.read::<Vel>(); | ||
/// | ||
/// // `World::get` allows to get a component from it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storage::get
src/lib.rs
Outdated
@@ -251,7 +249,8 @@ pub use storage::{MergeError, PackedData}; | |||
/// Please note that you should call `World::maintain` | |||
/// after creating / deleting entities with this resource. | |||
/// | |||
/// When `.join`ing on `Entities`, you will need to do it like this: | |||
/// When `.join`ing on `Entities`, you will need to do it like this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"When joining Entities
you will need to first dereference Entities
/Fetch<EntitiesRes>
to get the underlying EntitiesRes
, then you will need to re-reference it since only the referenced Entities
has an implementation of Join
."
Thanks, please review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better! Thank you!
Thanks for reviewing! bors r+ |
313: Improve Join and Entities docs r=torkleyy a=torkleyy Fixes #307 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/slide-rs/specs/313) <!-- Reviewable:end -->
Build succeeded |
Fixes #307
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)