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

Document part of bevy_ecs::Commands #976

Merged
merged 6 commits into from
Dec 3, 2020

Conversation

tangmi
Copy link
Contributor

@tangmi tangmi commented Dec 2, 2020

Here is a first pass at adding some clarification to Commands, which is a type that most folks need to use and can sometimes be confusing. This is not meant to be a "final draft" but are intended just to help answer some common questions for new users before bevy has more thorough docs.

I've specifically tried to address which methods should be called with bundles vs single components. This changeset renames some usages of components to bundle.

I'd also like to document the following, but need some further guidance for:

  • insert_local_resource: I'm unsure what SystemId is in relation to Resources (is it just like a namespace for archetypes?)
  • despawn: I'd like to clarify what "other considerations" the existing comment is referring to (currently documented as: Despawns only the specified entity, ignoring any other consideration.)

Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

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

Since latest rust version you can use easy intra doc links: https://doc.rust-lang.org/stable/rustdoc/linking-to-items-by-name.html

Could you link all items that make sense? (like the "See something")

crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
@mockersf
Copy link
Member

mockersf commented Dec 2, 2020

for despawn, I think the "considerations" are about hierarchy. despawn will just despawn the entity, not its children, unlike despawn_recursive

self
}

/// Equivalent to iterating of `components_iter` and calling `spawn` on each bundle, but slightly more performant.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this correct? I'm basing this off of the method signature, but World::spawn_batch's docs seem to imply that I should be an iterator of Component rather than Bundle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cart I wonder if you can help clarify this for me?

crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
crates/bevy_ecs/src/system/commands.rs Outdated Show resolved Hide resolved
@cart
Copy link
Member

cart commented Dec 2, 2020

insert_local_resource: I'm unsure what SystemId is in relation to Resources (is it just like a namespace for archetypes?)

"local resources" are resources created for a specific system. SystemId is a unique identifier for a system.

despawn: I'd like to clarify what "other considerations" the existing comment is referring to (currently documented as: Despawns only the specified entity, ignoring any other consideration.)

I'm guessing the author intended "other considerations" to be "children" (to contrast with the despawn_recursive command). I personally think we should just cut out that phrasing. We should just describe what despawning a specified entity does. We don't need to care about describing what it doesn't do.

@tangmi
Copy link
Contributor Author

tangmi commented Dec 2, 2020

Since latest rust version you can use easy intra doc links: https://doc.rust-lang.org/stable/rustdoc/linking-to-items-by-name.html

Could you link all items that make sense? (like the "See something")

It may be worth adding #![deny(broken_intra_doc_links)] whenever #![warn(missing_docs)] is considered to be added.

@memoryruins memoryruins added the C-Docs An addition or correction to our documentation label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Docs An addition or correction to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants