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

Change 'components' to 'bundles' where it makes sense semantically #1257

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/bevy_ecs/src/core/world_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ impl<'a> WorldBuilder<'a> {
self
}

pub fn with_bundle(&mut self, components: impl DynamicBundle) -> &mut Self {
pub fn with_bundle(&mut self, bundle: impl DynamicBundle) -> &mut Self {
self.world
.insert(self.current_entity.expect("Cannot add component because the 'current entity' is not set. You should spawn an entity first."), components)
.insert(self.current_entity.expect("Cannot add bundle because the 'current entity' is not set. You should spawn an entity first."), bundle)
.unwrap();
self
}

pub fn spawn_batch<I>(&mut self, components_iter: I) -> &mut Self
pub fn spawn_batch<I>(&mut self, bundle_iter: I) -> &mut Self
where
I: IntoIterator,
I::Item: Bundle,
{
self.world.spawn_batch(components_iter);
self.world.spawn_batch(bundle_iter);
self
}

pub fn spawn(&mut self, components: impl DynamicBundle) -> &mut Self {
self.current_entity = Some(self.world.spawn(components));
pub fn spawn(&mut self, bundle: impl DynamicBundle) -> &mut Self {
self.current_entity = Some(self.world.spawn(bundle));
self
}

Expand Down
11 changes: 4 additions & 7 deletions crates/bevy_transform/src/hierarchy/child_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ impl Command for PushChildren {
}

impl<'a> ChildBuilder<'a> {
pub fn spawn(&mut self, components: impl DynamicBundle + Send + Sync + 'static) -> &mut Self {
self.commands.spawn(components);
pub fn spawn(&mut self, bundle: impl DynamicBundle + Send + Sync + 'static) -> &mut Self {
self.commands.spawn(bundle);
self.push_children
.children
.push(self.commands.current_entity().unwrap());
Expand All @@ -85,11 +85,8 @@ impl<'a> ChildBuilder<'a> {
self.push_children.parent
}

pub fn with_bundle(
&mut self,
components: impl DynamicBundle + Send + Sync + 'static,
) -> &mut Self {
self.commands.with_bundle(components);
pub fn with_bundle(&mut self, bundle: impl DynamicBundle + Send + Sync + 'static) -> &mut Self {
self.commands.with_bundle(bundle);
self
}

Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_transform/src/hierarchy/world_child_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ pub struct WorldChildBuilder<'a, 'b> {
}

impl<'a, 'b> WorldChildBuilder<'a, 'b> {
pub fn spawn(&mut self, components: impl DynamicBundle + Send + Sync + 'static) -> &mut Self {
pub fn spawn(&mut self, bundle: impl DynamicBundle + Send + Sync + 'static) -> &mut Self {
let parent_entity = self
.parent_entities
.last()
.cloned()
.expect("There should always be a parent at this point.");
self.world_builder
.spawn(components)
.spawn(bundle)
.with_bundle((Parent(parent_entity), PreviousParent(parent_entity)));
let entity = self.world_builder.current_entity.unwrap();
{
Expand All @@ -38,9 +38,9 @@ impl<'a, 'b> WorldChildBuilder<'a, 'b> {

pub fn with_bundle(
&mut self,
components: impl DynamicBundle + Send + Sync + 'static,
bundle: impl DynamicBundle + Send + Sync + 'static,
) -> &mut Self {
self.world_builder.with_bundle(components);
self.world_builder.with_bundle(bundle);
self
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! and it gets more powerful every day!
//!
//! ### This Crate
//! The `bevy` crate is just a container crate that makes it easier to consume Bevy components.
//! The `bevy` crate is just a container crate that makes it easier to consume Bevy subcrates.
Copy link
Member Author

Choose a reason for hiding this comment

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

This one-off change is to avoid confusion between the abstract meaning of "components" and the ECS meaning by being more specific.

//! The defaults provide a "full" engine experience, but you can easily enable / disable features
//! in your project's `Cargo.toml` to meet your specific needs. See Bevy's `Cargo.toml` for a full list of features available.
//!
Expand Down