add version of the ecs's write_world method that takes a pre-boxed world writer (#661)

Co-authored-by: Nathan Jeffords <njeffords@comtechefdata.com>
This commit is contained in:
Nathan Jeffords 2020-10-14 14:01:08 -07:00 committed by GitHub
parent df64e1fc92
commit 7e23e132ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,8 +219,11 @@ impl CommandsInternal {
} }
pub fn write_world<W: WorldWriter + 'static>(&mut self, world_writer: W) -> &mut Self { pub fn write_world<W: WorldWriter + 'static>(&mut self, world_writer: W) -> &mut Self {
self.commands self.write_world_boxed(Box::new(world_writer))
.push(Command::WriteWorld(Box::new(world_writer))); }
pub fn write_world_boxed(&mut self, world_writer: Box<dyn WorldWriter + 'static>) -> &mut Self {
self.commands.push(Command::WriteWorld(world_writer));
self self
} }
@ -313,6 +316,11 @@ impl Commands {
self self
} }
pub fn write_world_boxed(&mut self, world_writer: Box<dyn WorldWriter + 'static>) -> &mut Self {
self.commands.lock().write_world_boxed(world_writer);
self
}
pub fn write_resources<W: ResourcesWriter + 'static>( pub fn write_resources<W: ResourcesWriter + 'static>(
&mut self, &mut self,
resources_writer: W, resources_writer: W,