From 7e23e132ef6a859962055dce7e1c2bcb8bd9d072 Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Wed, 14 Oct 2020 14:01:08 -0700 Subject: [PATCH] add version of the ecs's `write_world` method that takes a pre-boxed world writer (#661) Co-authored-by: Nathan Jeffords --- crates/bevy_ecs/src/system/commands.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ecs/src/system/commands.rs b/crates/bevy_ecs/src/system/commands.rs index 04e68b002d..90cab955f5 100644 --- a/crates/bevy_ecs/src/system/commands.rs +++ b/crates/bevy_ecs/src/system/commands.rs @@ -219,8 +219,11 @@ impl CommandsInternal { } pub fn write_world(&mut self, world_writer: W) -> &mut Self { - self.commands - .push(Command::WriteWorld(Box::new(world_writer))); + self.write_world_boxed(Box::new(world_writer)) + } + + pub fn write_world_boxed(&mut self, world_writer: Box) -> &mut Self { + self.commands.push(Command::WriteWorld(world_writer)); self } @@ -313,6 +316,11 @@ impl Commands { self } + pub fn write_world_boxed(&mut self, world_writer: Box) -> &mut Self { + self.commands.lock().write_world_boxed(world_writer); + self + } + pub fn write_resources( &mut self, resources_writer: W,