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

Improve Join and Entities docs #313

Merged
merged 3 commits into from
Dec 10, 2017
Merged

Improve Join and Entities docs #313

merged 3 commits into from
Dec 10, 2017

Conversation

torkleyy
Copy link
Member

@torkleyy torkleyy commented Dec 9, 2017

Fixes #307


This change is Reviewable

@torkleyy
Copy link
Member Author

torkleyy commented Dec 9, 2017

r? @Xaeroxe @Aceeri

@@ -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.
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

@Aceeri Aceeri left a 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`.
Copy link
Member

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:
Copy link
Member

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
Copy link
Member

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."

@torkleyy
Copy link
Member Author

Thanks, please review again.

Copy link
Member

@Xaeroxe Xaeroxe left a 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!

@torkleyy
Copy link
Member Author

Thanks for reviewing!

bors r+

bors bot added a commit that referenced this pull request Dec 10, 2017
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 -->
@bors
Copy link
Contributor

bors bot commented Dec 10, 2017

Build succeeded

@bors bors bot merged commit 0676b42 into amethyst:master Dec 10, 2017
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.

4 participants