use crate::{Scene, SceneList, WorldSceneExt};1use bevy_ecs::{error::Result, world::World};23/// Returns a system that spawns the given [`Scene`]. This should generally only be added to4/// schedules that run once, such as [`Startup`](bevy_app::Startup).5pub trait SpawnSystem {6/// Returns a system that spawns the given [`Scene`]. This should generally only be added to7/// schedules that run once, such as [`Startup`](bevy_app::Startup).8fn spawn(self) -> impl FnMut(&mut World) -> Result;9}1011impl<F: FnMut() -> S + Send + Sync + 'static, S: Scene> SpawnSystem for F {12fn spawn(mut self) -> impl FnMut(&mut World) -> Result {13move |world: &mut World| -> Result {14world.spawn_scene(self())?;15Ok(())16}17}18}1920/// Returns a system that spawns the given [`SceneList`]. This should generally only be added to21/// schedules that run once, such as [`Startup`](bevy_app::Startup).22pub trait SpawnListSystem {23/// Returns a system that spawns the given [`SceneList`]. This should generally only be added to24/// schedules that run once, such as [`Startup`](bevy_app::Startup).25fn spawn(self) -> impl FnMut(&mut World) -> Result;26}27impl<F: FnMut() -> S + Send + Sync + 'static, S: SceneList> SpawnListSystem for F {28fn spawn(mut self) -> impl FnMut(&mut World) -> Result {29move |world: &mut World| -> Result {30world.spawn_scene_list(self())?;31Ok(())32}33}34}353637