summaryrefslogtreecommitdiff
path: root/engine-ecs/src/actions.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-09-21 23:42:32 +0200
committerHampusM <hampus@hampusmat.com>2026-09-21 23:42:32 +0200
commit7003d9de96824f3e1cb67d56c1c4be883f6e2520 (patch)
tree896578ac2a3250e2bbbc405fbe8e1cf136ab0b90 /engine-ecs/src/actions.rs
parentdfa772c8c901500f679249c9a6e0bd25b05ca4d7 (diff)
refactor(engine-ecs): fix clippy lints
Diffstat (limited to 'engine-ecs/src/actions.rs')
-rw-r--r--engine-ecs/src/actions.rs33
1 files changed, 21 insertions, 12 deletions
diff --git a/engine-ecs/src/actions.rs b/engine-ecs/src/actions.rs
index 5eaa24e..d079a85 100644
--- a/engine-ecs/src/actions.rs
+++ b/engine-ecs/src/actions.rs
@@ -21,6 +21,9 @@ impl Actions<'_>
{
/// Queues up a entity to spawn at the end of the current tick, returning the [`Uid`]
/// that the entity will have.
+ ///
+ /// # Panics
+ /// This function will panic if any component in `bundle` is a [`Sole`].
pub fn spawn<BundleT: Bundle>(&mut self, bundle: BundleT) -> Uid
{
let new_entity_uid = Uid::new_unique();
@@ -45,6 +48,9 @@ impl Actions<'_>
///
/// In addition to the given components, the entity will have a [`EntityName`]
/// component containing `name`.
+ ///
+ /// # Panics
+ /// This function will panic if any component in `bundle` is a [`Sole`].
pub fn spawn_named<BundleT: Bundle>(
&mut self,
name: impl Into<Cow<'static, str>>,
@@ -105,6 +111,9 @@ impl Actions<'_>
}
/// Queues up adding component(s) to a entity at the end of the current tick.
+ ///
+ /// # Panics
+ /// This function will panic if any component in `bundle` is a [`Sole`].
pub fn add_components<BundleT: Bundle>(&mut self, entity_uid: Uid, bundle: BundleT)
{
debug_assert!(!entity_uid.is_pair());
@@ -198,7 +207,7 @@ impl Actions<'_>
pub fn set_pair_target(
&mut self,
entity_id: Uid,
- pair: Pair<Uid, Uid>,
+ pair: &Pair<Uid, Uid>,
new_target_id: Uid,
)
{
@@ -215,8 +224,8 @@ impl Actions<'_>
let pair_id = pair.id();
self.action_queue.push(Action::SetPair {
- entity_id: entity_id,
- pair_id: pair_id,
+ entity_id,
+ pair_id,
new_pair: Pair::builder()
.relation_id(pair_id.relation())
.target_id(new_target_id)
@@ -235,7 +244,7 @@ impl Actions<'_>
pub fn set_pair_target_and_data<NewTarget>(
&mut self,
entity_id: Uid,
- pair: Pair<Uid, Uid>,
+ pair: &Pair<Uid, Uid>,
new_target: NewTarget,
) where
NewTarget: Component,
@@ -252,8 +261,8 @@ impl Actions<'_>
let pair_id = pair.id();
self.action_queue.push(Action::SetPair {
- entity_id: entity_id,
- pair_id: pair_id,
+ entity_id,
+ pair_id,
new_pair: Pair::builder()
.relation_id(pair_id.relation())
.target_as_data(new_target)
@@ -272,7 +281,7 @@ impl Actions<'_>
pub fn set_pair_relation(
&mut self,
entity_id: Uid,
- pair: Pair<Uid, Uid>,
+ pair: &Pair<Uid, Uid>,
new_relation_id: Uid,
)
{
@@ -289,8 +298,8 @@ impl Actions<'_>
let pair_id = pair.id();
self.action_queue.push(Action::SetPair {
- entity_id: entity_id,
- pair_id: pair_id,
+ entity_id,
+ pair_id,
new_pair: Pair::builder()
.relation_id(new_relation_id)
.target_id(pair_id.target())
@@ -309,7 +318,7 @@ impl Actions<'_>
pub fn set_pair_relation_and_data<NewRelation>(
&mut self,
entity_id: Uid,
- pair: Pair<Uid, Uid>,
+ pair: &Pair<Uid, Uid>,
new_relation: NewRelation,
) where
NewRelation: Component,
@@ -326,8 +335,8 @@ impl Actions<'_>
let pair_id = pair.id();
self.action_queue.push(Action::SetPair {
- entity_id: entity_id,
- pair_id: pair_id,
+ entity_id,
+ pair_id,
new_pair: Pair::builder()
.relation_as_data(new_relation)
.target_id(pair_id.target())