Skip to content

Commit

Permalink
Make Children constructor pub(crate). (bevyengine#5532)
Browse files Browse the repository at this point in the history
bevyengine#4197 intended to remove all `pub` constructors of `Children` and `Parent` and it seems like this one was missed.

Co-authored-by: devil-ira <justthecooldude@gmail.com>
  • Loading branch information
2 people authored and james7132 committed Oct 28, 2022
1 parent 95a51ce commit 637800c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 637800c

Please sign in to comment.