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

[Merged by Bors] - Make Children constructor pub(crate). #5532

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions crates/bevy_hierarchy/src/child_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ impl<'w> BuildWorldChildren for EntityMut<'w> {
.retain(|value| !children.contains(value));
children_component.0.extend(children.iter().cloned());
} else {
self.insert(Children::with(children));
self.insert(Children::from_entities(children));
}
self
}
Expand All @@ -435,7 +435,7 @@ impl<'w> BuildWorldChildren for EntityMut<'w> {
.retain(|value| !children.contains(value));
children_component.0.insert_from_slice(index, children);
} else {
self.insert(Children::with(children));
self.insert(Children::from_entities(children));
}
self
}
Expand Down Expand Up @@ -479,7 +479,7 @@ impl<'w> BuildWorldChildren for WorldChildBuilder<'w> {
} else {
self.world
.entity_mut(parent)
.insert(Children::with(children));
.insert(Children::from_entities(children));
}
self
}
Expand All @@ -497,7 +497,7 @@ impl<'w> BuildWorldChildren for WorldChildBuilder<'w> {
} else {
self.world
.entity_mut(parent)
.insert(Children::with(children));
.insert(Children::from_entities(children));
}
self
}
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_hierarchy/src/components/children.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ impl FromWorld for Children {
}

impl Children {
/// Builds and returns a [`Children`] component with the given entities
pub fn with(entity: &[Entity]) -> Self {
Self(SmallVec::from_slice(entity))
/// Constructs a [`Children`] component with the given entities.
pub(crate) fn from_entities(entities: &[Entity]) -> Self {
Self(SmallVec::from_slice(entities))
}

/// Swaps the child at `a_index` with the child at `b_index`
/// Swaps the child at `a_index` with the child at `b_index`.
pub fn swap(&mut self, a_index: usize, b_index: usize) {
self.0.swap(a_index, b_index);
}
Expand Down