Skip to content

Commit c37939d

Browse files
committed
Make Children constructor pub(crate). (#5532)
#4197 intended to remove all `pub` constructors of `Children` and `Parent` and it seems like this one was missed. Co-authored-by: devil-ira <[email protected]>
1 parent 54750de commit c37939d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

crates/bevy_hierarchy/src/child_builder.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl<'w> BuildWorldChildren for EntityMut<'w> {
414414
.retain(|value| !children.contains(value));
415415
children_component.0.extend(children.iter().cloned());
416416
} else {
417-
self.insert(Children::with(children));
417+
self.insert(Children::from_entities(children));
418418
}
419419
self
420420
}
@@ -435,7 +435,7 @@ impl<'w> BuildWorldChildren for EntityMut<'w> {
435435
.retain(|value| !children.contains(value));
436436
children_component.0.insert_from_slice(index, children);
437437
} else {
438-
self.insert(Children::with(children));
438+
self.insert(Children::from_entities(children));
439439
}
440440
self
441441
}
@@ -479,7 +479,7 @@ impl<'w> BuildWorldChildren for WorldChildBuilder<'w> {
479479
} else {
480480
self.world
481481
.entity_mut(parent)
482-
.insert(Children::with(children));
482+
.insert(Children::from_entities(children));
483483
}
484484
self
485485
}
@@ -497,7 +497,7 @@ impl<'w> BuildWorldChildren for WorldChildBuilder<'w> {
497497
} else {
498498
self.world
499499
.entity_mut(parent)
500-
.insert(Children::with(children));
500+
.insert(Children::from_entities(children));
501501
}
502502
self
503503
}

crates/bevy_hierarchy/src/components/children.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ impl FromWorld for Children {
3636
}
3737

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

44-
/// Swaps the child at `a_index` with the child at `b_index`
44+
/// Swaps the child at `a_index` with the child at `b_index`.
4545
pub fn swap(&mut self, a_index: usize, b_index: usize) {
4646
self.0.swap(a_index, b_index);
4747
}

0 commit comments

Comments
 (0)