From 7c578b47f5046251528e996ff00f997637385761 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Thu, 9 Feb 2023 02:10:21 +0000 Subject: [PATCH] feat(bones_ecs): make `insert_stage_before/after()` chainable. (#90) --- crates/bones_ecs/src/stage.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/bones_ecs/src/stage.rs b/crates/bones_ecs/src/stage.rs index 9e59126548..79e0f9a7f0 100644 --- a/crates/bones_ecs/src/stage.rs +++ b/crates/bones_ecs/src/stage.rs @@ -76,13 +76,15 @@ impl SystemStages { &mut self, label: L, stage: S, - ) { + ) -> &mut Self { let stage_idx = self .stages .iter() .position(|x| x.id() == label.id()) .unwrap_or_else(|| panic!("Could not find stage with label `{}`", label.name())); self.stages.insert(stage_idx, Box::new(stage)); + + self } /// Insert a new stage, after another existing stage @@ -91,13 +93,15 @@ impl SystemStages { &mut self, label: L, stage: S, - ) { + ) -> &mut Self { let stage_idx = self .stages .iter() .position(|x| x.id() == label.id()) .unwrap_or_else(|| panic!("Could not find stage with label `{}`", label.name())); self.stages.insert(stage_idx + 1, Box::new(stage)); + + self } }